Closed howew closed 8 years ago
Yes this would be possible with some modification to the TempFileSystemStorage
.
I think this with combination of nesting these folders to prevent hundreds and thousands of files in the same directory. Also all random directories need to be placed in one folder in the temp, to be easy for traversing and deleting old files (and probably empty directories).
Would it be possible to modify the code to store the files in a unique folder within the temp or /tmp directories? This would eliminate the chance of a file residing in the temp folder with the same name, which causes the file to be renamed on the subsequent attempt.
So if you try to upload "myfile.txt" twice, instead of storing it like this: /tmp/myfile.txt (first attempt) /tmp/myfile_3sdf93F.txt (second attempt)
It would store it like this: /tmp/3ksefj3w3/myfile.txt (first attempt) /tmp/sdflk339sf/myfile.txt (second attempt)
For my project, it only makes sense to rename the file if there is a conflict when it is moved to its final destination, not while it is in the temporary directory or other storage folder.