Reputation: 402
I want to upload images Facebook style: select the images before submitting the form and when they are all uploaded, submit the form instantly. I know how to do it in the frontend, but the problem is in the backend. I have found some ways of managing the images in the backend but I'm not satisfied. The great deal of all this is avoiding to store the photos that won't be used, like if the user closes the browser while some photos are already uploaded. I have in mind 3 ways of doing the upload and I don't know which would be the best:
Upvotes: 0
Views: 113
Reputation:
I think your first way with some reformations is the best way. You can create a tmp
directory and attach a unique data (e.g. IP address) to each image that takes control on concurrency and then write some script in $(window).unload(...)
for send a signal to the backend that remove the image(s) from tmp
directory when user close window before submitting the form.
Upvotes: 1