fastapi-storages
fastapi-storages copied to clipboard
Same file name
Hi,
how is the same file name supperted? as I tried it did not check if a file with the same name exists and just over writed it. can you add some mechanism to detect file exists and add some hash for example to the end of the file?
Thanks
Hi Hassan. This is usually done on the backend side by the developer themselves. Your storage may be huge and inserting in that case will take a lot of time. I usually add uuid4 hashes to the end of the name or instead of the name.
We do handle the files with the same name, there's a configuration to change this behaviour: OVERWRITE_EXISTING_FILES
We either overwrite them or create new ones with a different suffix like _1, _2, etc.