Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to delete uploaded file when user navigates to another page before submitting form? #159

Open
perkalerk opened this issue Nov 21, 2019 · 1 comment

Comments

@perkalerk
Copy link

Hello,

For my example, let's say a user uploads a file in step 1 of the Wizard, then goes to step 2 and navigates to another page without submitting the form. What method can I use to detect this action so that I can delete the user's uploaded file and not have it junk up the file system?

I've gotten it so that the file is deleted on a reload but not if the user enters a URL into the browser and loads a new page.

@ShaheedHaque
Copy link

In general, since the server has no clue that the user has gone away (or indeed might come back), I don't think there is any explicit trigger that one can rely on. What I do is that I ensure all file storage is kept in a well-known tree and run a daily "batch" job that clears the tree of files which have been there more than 2 days.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants