I may have missed this somewhere. But is it possible to get the chunked upload directory to automatically clean up at upload completion?
My upload completion assigns the file to a model file field, which results in the file being copied to a new location. However, the chunked_upload '.part' data accumulates.
Sorry for the (very) late response. There are a couple of ways to do what you want:
You can override the on_completion() method of ChunkedUploadCompleteView [1] to delete the instance once you've used the uploaded file (saved it somewhere else, processed it, etc.). When deleting the instance, don't forget to pass delete_file=True (see BaseChunkUpload.delete).
The problem with the previous solution is that the incomplete or failing ChunkedUploads will pile up (since they never get to run on_completion). So the other option is to run the management command delete_expired_upload. This commands cleans the inactive chunks based on CHUNKED_UPLOAD_EXPIRATION_DELTA. You can use a cron job to run this once a day/week/etc. Read StackOverflow: Django custom command and cron for how to do this.
Hello
I may have missed this somewhere. But is it possible to get the chunked upload directory to automatically clean up at upload completion?
My upload completion assigns the file to a model file field, which results in the file being copied to a new location. However, the chunked_upload '.part' data accumulates.
Thanks!