juliomalegria / django-chunked-upload

Upload large files to Django in multiple chunks, with the ability to resume if the upload is interrupted.
MIT No Attribution
218 stars 73 forks source link

Handle whole file upload #3

Closed qwattash closed 10 years ago

qwattash commented 10 years ago

Hi,

I was trying to understand how to make the ChunkedUploadCompleteView handle a whole file upload as a last chunk, il could be useful to have a method called when the file upload is not chunked. I have seen that someone checks for existence of the HTTP_X_FILE_NAME header to distinguish between the two, but I don't know how clean this solution may be.

Thanks! Keep up the good work!

juliomalegria commented 10 years ago

Hey @qwattash (sorry for the late response), Right now, the cleanest way I'd suggest would be to make a call to ChunkedUploadView with the whole whole file (i.e. Content-Range: bytes: 0-B/B+1, being B+1 the total bytes of the file), and right after that make a call to ChunkedUploadCompleteView. This would indicate that the file upload is ready.