Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete an image based on URL on WEB

I cannot find a function like 'getReferenceFromUrl' on the web Firebase. I have stored a reference to the URL (and not the name of the image) for each item in my database.

Is there any workaround to get the reference on the image with the URL?

like image 969
Perelan Avatar asked Jan 10 '17 20:01

Perelan


1 Answers

Yep, it's in the docs, maybe a little hidden.

// Create a reference to the file to delete
var desertRef = firebase.storage().refFromURL('https://firebasestorage.googleapis.com...')

// Delete the file
desertRef.delete().then(function() {
  // File deleted successfully
}).catch(function(error) {
  // Uh-oh, an error occurred!
});
like image 141
Mike McDonald Avatar answered Oct 23 '22 20:10

Mike McDonald