Buckets are really nice, but in my app theres a specific bucket in which the files should have unique filenames, is this possible?
Hello, files in buckets were designed to allow duplicate names. This was mainly due to storage being used in file uploads such as profile picture, blog cover page, or product image. In typical scenario, requiring unique names could cause a lot of trouble across products, or even across different end users.
What must be unique is fileID. A simple solution for you would be to provide custom file ID when uploading, and generating the ID from ms5 hash of file name. This will provide you unique email for every file, but makes duplication error when file with same name is uploaded.
Would this solution work well for you?
If you plan to do more complex logic with files, a good future-proof solution could be to upload a file, but then make a document for it in a collection. This way you can have more attributes, permissions, and further customize indexes. This way you only use buckets to store files, but source of truth for metadata would be document
providing a custom fileID seems like a good solution for me in the meantime , thanks
Recommended threads
- Websites hosted on my appwrite sites hav...
Hello, all my websites hosted on appwrite sites are not running I am getting this message "This site can’t be reached drivehub.appwrite.network took too long t...
- Can't really use the S3 storage device
hi, I've linked my local MinIO Instance (it's just for testing, not for prod.) to my appwrite instance, when i'm uploading a file it's getting uploaded to the S...
- Storage Chunk upload bug
Hi, I'm experiencing an issue with Appwrite Storage chunked uploads. Small files upload successfully, but larger video files that require chunking fail. For ...