reatime firebase upload zip URL

166 Views Asked by At

enter image description here

I need this type of URL(I show in picture) of my file in Realtime firebase database. I am unable to write JavaScript code

1

There are 1 best solutions below

0
On

If you are uploading with a script, you then need to fetch the download URL from the reference. this can be done with the following (Firebase web methods with javascript)

// Put the file into storage
var uploadTask = storageRef.child('images/rivers.zip').put(file)
// catch the snapshot of storage upload and get download URL
.then(snapshot => snapshot.ref.getDownloadURL())
// send download URL to realtime database
.then((downloadURL) => {
    firebase.database().ref('files/' + FileID + '/url'.set(downloadURL);
    })
.catch(console.log());