When you say update, you mean you want to change the image or perform actions and then update?
[SOLVED] Update Image File to Storage
Votes
1
Replies
24
Participants
Unknown
Messages
25
Rank 2: Process
change the image
Rank 2: Process
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.
Rank 2: Process
I'll try it and post it later
Rank 2: Process
I tried it but...
Rank 2: Process
New picture is successfully downloaded to the Storage
Rank 2: Process
but when i getFilePreview this shows me past picture
Rank 2: Process
maybe I'll wait a few minutes or this is error here?
did you try again now?
did you re-use the same ID?
Rank 2: Process
Yes
i highly advise against this due to caching.
Rank 2: Process
I have one idea, i'll try it and report later
Rank 2: Process
i'm trying to save new file id in user's prefs but
Rank 2: Process
This code ALWAYS returns unique() string
Rank 2: Process
String newAvatarFileId = (String) ID.Companion.unique();
Rank 2: Process
Why this code isn't generate random id string?
Rank 2: Process
P.S but
Rank 2: Process
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
Rank 2: Process
how to catch this value and save in the prefs?
Get the file id from the response of create file
Rank 2: Process
Thanks, it FINALLY works!
[SOLVED] Update Image File to Storage