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
- Error getting preview of file
Rest Response: ``` { "message": "Server Error", "code": 500, "type": "general_unknown", "version": "1.8.1" } ``` Appwrite Logs ``` appwrite ...
- Storage images using custom domain retur...
Some of the images uploaded to my storage bucket returns this error: ``` { "message": "Project with the requested ID could not be found. Please check the value...
- Bandwidth limit for your organization ha...
I received an alert that I exceeded the Free plan bandwidth limit (showing 5.86 GB), but my dashboard tells a different story. The usage stats there are much lo...