When you say update, you mean you want to change the image or perform actions and then update?
change the image
this is function that change user's logo image
amm, you cannot actually make changes, you can upload a new image, and use new ID. This approach helps with 0 downtime during image update.
I'll try it and post it later
I tried it but...
New picture is successfully downloaded to the Storage
but when i getFilePreview this shows me past picture
maybe I'll wait a few minutes or this is error here?
did you try again now?
did you re-use the same ID?
Yes
i highly advise against this due to caching.
I have one idea, i'll try it and report later
i'm trying to save new file id in user's prefs but
This code ALWAYS returns unique() string
String newAvatarFileId = (String) ID.Companion.unique();
Why this code isn't generate random id string?
P.S but
in this code works correct only createFile() function
because that's what the function does: https://github.com/appwrite/sdk-for-android/blob/10cc15d7546e9dae5eb131c77270b5d89c82d894/library/src/main/java/io/appwrite/ID.kt#L8
The server detects "unique()" and generates a unique ID server-side
how to catch this value and save in the prefs?
Get the file id from the response of create file
Thanks, it FINALLY works!
[SOLVED] Update Image File to Storage
Recommended threads
- getFilePreview , getFileView , getFileDo...
I am on Appwrite self hosted 1.8.0 I use the web sdk 21.3.0 I created a bucket and it has this permission (users:create) then i enabled the file security then ...
- One org lost all data out of 13 org's af...
> https://<domain>/v1/storage/buckets?queries%5B0%5D=%7B%22method%22%3A%22limit%22%2C%22values%22%3A%5B6%5D%7D&queries%5B1%5D=%7B%22method%22%3A%22offset%22%2C%...
- Failed to load data from database
My app broken, it throw AppwriteException exception. Few days ago it works well. AppwriteException: , ClientException with SocketException: Failed host lookup:...