Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

281
Views
How can i Get image url from firabse storage

I am trying to upload image in firebase storage. Photo is uploaded, but I can't get the url. I got the source code from firebase, so I think my code is right but I don't no why this is happening. Could anyone please tell me how can I get the url?

My code is here:

firebase.initializeApp(firebaseConfig);
firebase.analytics();

var file = document.querySelector("#file").value;
const storageRef = firebase.storage().ref();

function uploadFile() {
    var file = document.getElementById('file').files[0];
    var uploadTask = storageRef.child('images/' + file.name).put(file);

    uploadTask.on('state_changed',
        (snapshot) => {
            var progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
            alert('Upload is ' + progress + '% done');

            switch (snapshot.state) {
                case firebase.storage.TaskState.PAUSED:
                    alert('Upload is paused');
                    break;
                case firebase.storage.TaskState.RUNNING:
                    alert('Upload is running');
                    break;
            }
        },
        (error) => {

        },
        () => {
            uploadTask.snapshot.ref.getDownloadURL().then((downloadURL) => {
                alert(downloadURL)
                document.getElementById('image').src = downloadURL;
                alert('File available at', downloadURL);
            });
        }
    );
}
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!