I am dealing with profile pictures in my ionic 1 App. I am searching for a way to update a file in firebase storage such that the download link remains the same. Is it possible or any other way to achieve the required?
To delete a file, first create a reference to that file. Then call the delete() method on that reference, which returns a Promise that resolves, or an error if the Promise rejects.
The Firebase Storage token does not expire (see Stack Overflow). Therefore, without any other modifications, our downloadUrl also never expires and remains available.
Select the category you want to manage. Select the files you want to remove. To sort files, at the top, tap Filter . After you select your files, at the top, tap Delete .
You can't update the file and maintain the same public download link--it's a different file, so it's assumed that you might want to change the access permissions
Just re-fetch the URL and download the file once it's been updated (it's actually returned in the metadata returned on upload, so you can send it to other apps right after you change it, no need to grab the URL separately):
var file = ... // use the Blob or File API
ref.put(file).then(function(snapshot) {
var url = snapshot.downloadURL;
});
As the other answer says, basically you cant update the image without it changing the permissions.
BUT, if you change your rules for the path where your image is stored to say
allow read: if true;
allow write: if request.auth != null;
this basically makes it where anyone with the link can see the image. This will let you see the new image from the old download link.
But just know that this also means anybody with this link can see the image, not just people from your app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With