Efficiently saving a file by hash in Django
问题 I am working on a Django project. What I want the user to be able to do is upload a file (through a Form) and then save the file locally to a custom path and with a custom filename - its hash. The only solution I can think of is by using the "upload_to" argument of the FileField I'm using. What this translates to (I think): 1) Write the file to disk 2) Calculate hash 3) Return path + hash as filename The problem is that there are two write operations: one when saving the file from memory to