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
- Clarification about `Content` in terms a...
Hello, I'm looking into using Appwrite's cloud storage and got a bit concerned about this part in the terms page: https://appwrite.io/terms#content > Our Serv...
- ClamAV antivirus scanning only works wit...
https://github.com/appwrite/appwrite/issues/10921 pleas assign this issue to me
- Issue with downloading large files (40GB...
Hi everyone! I am using the latest Appwrite 1.8.0 version on my self-hosted server. I successfully uploaded a large ZIP archive (~40GB) using the chunked uploa...