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
- Update User Error
```ts const { users, databases } = await createAdminClient(); const session = await getLoggedInUser(); const user = await users.get(session.$id); if (!use...
- apple exchange code to token
hello guys, im new here 🙂 I have created a project and enabled apple oauth, filled all data (client id, key id, p8 file itself etc). I generate oauth code form...
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...