I have a form on my site to submit posts, it features multiple file upload tool (Mini Ajax File Upload Form) which submits files to server as they are added (before actual post submission) and server then stores them in temp dir. Once article has been submitted, all associated files are stored to uploads dir and temp dir is cleared.
How should I clean temp dir from files left after posts where files were added but which were never submitted? Should I do it just from time to time using, say, cron script or is it better to do whenever site scripts run?
Post submission must be anonymous (with captcha or some more difficult verification), so I'm concerned with server being stuffed with files from abandoned forms.