1

I am using jQuery File Upload plugin by blueimp and everything works fine. But I've just realized that if users upload files and navigate away from the page without completing the form, it will create "orphan" files.

Is there a way to delete files onbeforeunload?

1 Answer 1

2

There is, but its not guaranteed to work 100% of the time.

To make sure temp files don't pile up you have to implement some sort of 'garbage collection'. You can do it in a cron job, or with a certain probability on every upload request.

Sign up to request clarification or add additional context in comments.

1 Comment

Yeah, thinking about it, with onbeforeunload, there are many scenarios where users can bypass it and the problem wouldn't really be solved. The garbage collector sounds more reliable. Thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.