How to get filename from download link in Firebase Storage (Javascript, React)?


Ken

I am trying to get the filename from firebase storage. Now I have a download link and am trying to get the name from it.

const showPhoto = () => {
        var eventDOM = event.target;
        var src = eventDOM.getAttribute('src');
        setpickImage(src);
        console.log(src);
        // src = "https://firebasestorage.googleapis.com/v0/b....."
}

enter image description here

I need the filename to delete the file from storage.

Frank Vampfelen

If you want to map the download URL back to the filename, use the refFromURLmethod .

See also the documentation on creating citations from download URLs , which includes the following examples:

var httpsReference = storage.refFromURL('https://firebasestorage.googleapis.com/b/bucket/o/images%20stars.jpg');

ReferenceThen you can get other properties from it, such as the filename .

let fileName = httpsReference.name;

Related


urllib: get filename from direct download link

spike Python3. Might need to use urllib to do this, I need to know how to send a request to a direct download link and get the name of the file it is trying to save. (eg KSP mod from CurseForge: https://kerbal.curseforge.com/projects/mechjeb/files/235538 7/dow

urllib: get filename from direct download link

spike Python3. Might need to use urllib to do this, I need to know how to send a request to a direct download link and get the name of the file it is trying to save. (eg KSP mod from CurseForge: https://kerbal.curseforge.com/projects/mechjeb/files/235538 7/dow

urllib: get filename from direct download link

spike Python3. Might need to use urllib to do this, I need to know how to send a request to a direct download link and get the name of the file it is trying to save. (eg KSP mod from CurseForge: https://kerbal.curseforge.com/projects/mechjeb/files/235538 7/dow

urllib: get filename from direct download link

spike Python3. Might need to use urllib to do this, I need to know how to send a request to a direct download link and get the name of the file it is trying to save. (eg KSP mod from CurseForge: https://kerbal.curseforge.com/projects/mechjeb/files/235538 7/dow

Get download URL from Firebase Storage in Angular

Monther I'm trying to get the download URL after uploading a file to Firebase Storage, so far I've been able to upload the file, but for the URL, I've been getting undefined, this is my code: onFileChanged(event) { const file: File = event.target.files[0];

Unable to get download url from firebase storage

Pannan I can upload the image successfully but can't get the URL of the uploaded image Also with the recent changes to the method I would like to write a cleaner code than this. try { await FirebaseStorage.instance .ref()

Get download URL from Firebase Storage in Angular

Monther I'm trying to get the download URL after uploading a file to Firebase Storage, so far I've been able to upload the file, but for the URL, I've been getting undefined, this is my code: onFileChanged(event) { const file: File = event.target.files[0];

How to wait for download url in javascript firebase storage?

Angelo I have a map that will take a set of files and will return a set of download urls from firebase storage. const imageUrls = images.map((image, index) => { const imageUploadTask = storage() .ref(`products/${dataUser.name}/${name}/${image.name}${

Download file link from Firebase Storage using python

Fabio Margarelli There seems to be a very lack of documentation on the firebase python API. What I want to do is get download links for all files in firebase storage folder through my Flask app. My latest method is: from firebase_admin import storage bucket =

How to download an entire folder from Firebase Storage?

isuru: I want to download an entire folder from Firebase Storage. I can download individual files using DownloadURLthe following method , but not for folders. var storageRef = firebase.storage().ref(); // Create a reference to the file we want to download var

How to download an entire folder from Firebase Storage?

isuru: I want to download an entire folder from Firebase Storage. I can download individual files using DownloadURLthe following method , but not for folders. var storageRef = firebase.storage().ref(); // Create a reference to the file we want to download var