52549

Is there a way to overwrite a saved file in firebase storage?

<h3>Question</h3>

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?


<h3>Answer1:</h3>

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; });
<h3>Answer2:</h3>

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.

来源:https://stackoverflow.com/questions/41423890/is-there-a-way-to-overwrite-a-saved-file-in-firebase-storage

Recommend

  • Is there a way to overwrite a saved file in firebase storage?
  • React.default.memo is not a function (React-Native) wrapWithConnect
  • Critical sections in ARM
  • Get full URL inside SignalR hub
  • MSBuild / Visual Studio distributed builds
  • AWS PHP SDK issue (DynamoDB)
  • Medical Values: 1 Super Exam Table or Lots of Exam Tables
  • How to access native iOS file system using Sencha touch 2 alone
  • How to catch crash without disturbing the normal crash flow
  • Why does `[DllImport]` fail with an entry point of `RtlSecureZeroMemory`, even though it is a well d
  • An AppBar application not working correctly in Windows 8.x/10 (desktop working area does not get red
  • iOS how to make a button run a code for another view controller?
  • Why I receive this error using componentWillReceiveProps?
  • Two hosts in jdbc url
  • Read attribute/value pairs from XML file using Linq
  • Parse and remove special characters in java regex
  • can I build CMakeLists.txt from a set of smaller files (to improve the readability and maintainabili
  • Google TV VideoView playing YouTube rtsp videos
  • How to find angle formed by the blades of a wind turbine with respect to a horizontal imaginary axis
  • python selenium scraping tbody
  • Regex not working in java 1.5
  • When to use the tag in the head and body section of a html page? [duplicate]
  • Annotate objects in a queryset with next and previous object ids
  • Possible to set default CloudKit container not based on application name?
  • Dynamic XML Schema Validates Subsection of Document
  • Ruby regex for matching simpliest Ruby's regexes
  • concise way of flattening multiindex columns
  • gnuplot - How to make zmin equal to zmax keeeping autoscale on z axis
  • Neo4j…how to get a visual representation of my data?
  • Support of :after in IE7
  • JavaScript Regex to Match Boundaries of Words with diacritics
  • Cloud Code: Creating a Parse.File from URL
  • Change cell value based on cell color in google spreadsheet
  • Android: Unable to detect vertical plane
  • Will this work on all screen sizes?
  • Debug `Unexpected end of JSON input Error` on content script
  • Make checkout phone field optional for specific countries in WooCommerce
  • Codeigniniter insert data through models and controller
  • Spring Boot not autowiring @Repository
  • ARKit code issue {unknown error -1=ffffffffffffffff error: Task failed with exit 1}