Hello, i referred to the documentation, and understood that updateFile does not actually replace the file content.
I have a form that let user upload file, and the form can be edited too.
During the edit, I am trying to compare the existing uploaded file against the file that will be uploaded. Would you have any suggestion what is the recommended way to compare the existing file against the file to be uploaded?
using filename to compare is not appropriate because user can reupload a different file but maintain the same filename. I feel that it may be computationally expensive to download the full file from AppWrite and compare it against the new file everytime someone edit the form. And would rather do an updateFile instead. However, updateFile does not currently overwrite the uploaded file. Would you have any advice for me?
thanks a lot
Hello @Said H When you're uploading a file, a file id is being automatically creating and the file is being stored in the Appwrite storage
Since, you want to update the image, make sure that you have an attribute called image or imageID in your collection
which will get updated with the updated image id
and get rendered properly on form submit
Hope this helps
Get file returns data about the file including an md5 hash. Maybe that will help?
https://appwrite.io/docs/client/storage?sdk=web-default#storageGetFile
thanks @Susmita and @Steven MD5 signature does help perfectly!
[SOLVED] Compare uploaded file with to-be uploaded file
Recommended threads
- All My Project is Gone
Hello everyone, please help. Why have all my projects suddenly disappeared? I received a warning via email about one of my projects being paused. When I clicked...
- CORS errors in Obsidian custom plugin
Hi, anyone here familiar with obsidian community plugins? In short: it's a local first note app which supports writing your own add-ons / plugin But I keep get...
- > AppwriteException: The requested servi...
When trying to read or write from my database I get the following error: > AppwriteException: The requested service is disabled. You can enable the service from...