Has anyone had experience with this?
I wrote (with help of Google) a system that:
Preps the file and makes sure things are a-ok to start uploading.
Uploads a small portion of the file (2k) to make sure things will be able to be uploaded properly. I found that any issues PHP/server has will not be seen or reported until the first chunk is completely uploaded.
Uploads the rest of the file in 1Mb chunks and appends their index to their filename.
Once all chunks are uploaded, another xhr request is made that merges the files in order (using a loop and the last index uploaded).
I have a question for anyone who has written file chunking stuff before regarding abandoned uploads
If the user uploaded 50% of the file then leaves the page, their chunks remain on the server. I’d assume I’d need to store the chunks in a temp folder somewhere that I can occasionally clean out. What’s the best method to clean this folder out, or is there another way to make sure file chunks aren’t being left behind?