Creation of model instances in case of large uploads
iw108 opened this issue · 4 comments
Hi,
Currently, create_uploaded_file_in_db
is creating a copy of the uploaded file, which is then saved to the created TemporaryUploadedFile
instance, and the original file deleted. This is fine for small uploads, however for large uploads e.g. O(GB), the processing speed takes a significant hit, especially as the file may be copied again (depending on how things are set up) when it is saved to another non temporary model.
Prior to v2.2, the uploaded file was defined as a string pointing to the path of the original uploaded file. This prevented the copying of the file. The inclusion of django.core.files.File
has changed this behaviour.
Is is possible to make create_uploaded_file_in_db
configurable, so the copying can be avoided if desired?
Maybe I can optimize this without a new configuration option. Let me see if this is possible.
The pr is merged. I will release a new version in a couple of days.
Fixed in version 3.1.1