As you can see from my previous posts, I've been working to get the jQuery script "Fine Uploader" to work well.
One issue I have is the abandoned form. The user could potentially upload several images, which are stored on the server like:
/server/fineuploader/files/xxxx-xxxx-xxxx-xxxx/image.jpg
/server/fineuploader/files/yyyy-yyyy-yyyy-yyyy/image_2.jpg
And then I have a Javascript array that saves both the uuid (the xxxx...) and the image name. When they submit the form I send the array to a Perl script, which then moves the images, resizes them, etc.
But if they abandon the form for some reason, the images stay on the server.
My thought is to write an Ajax script to run when they leave the page, so I could then use the array to delete both the directory and the image in that directory. But the only way I can find to do this is:
<element onunload="ajax('whatever.php')">
The problem with that is that I think onunload will run when they submit the form, too, right? Which would defeat the purpose, as I do need the images to be there while the Perl script runs.
Can you guys think of a better way to remove the images from an abandoned form?