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

190
Views
I need to get the download URL from Firebase, Storage , using JavaScript, in html , The Picture gets uploaded , but I get no DownloadURL?

When I hit upload the picture gets uploaded to firebase Storage, but i cant seem to get the image url, I can go to the Storage tab on firebase click on the image and click on its ling , copy the link in and then past it into the DATABASE were i need it for display and it will work, But i dont see an image URL or A download URL when i consolo.log the snapshot of the const TASK!
I fear that the method:

const task = uploadBytesResumable(storeref, ImSRC, metdata)

that iam using to upload the image does not produce an image url! Could This be So? !!!HERE IS ALL THE CODE FOR THE UPLOAD BUTTON !!

Upload.addEventListener('click', (e) =>{
    
    let ImSRC = files[0];
    
    if(ImSRC == null ){
        alert('no picture selected');
    }else{
            const metdata = {
            contentType: ImSRC.type
            }
            const storeref = sRef(storage,"UsersProPic/" + cUserID);
            const task = uploadBytesResumable(storeref, ImSRC, metdata).then((snapshot)=>{
                    console.log(snapshot);
                    function getData(){
                        
                            snapshot.getDownloadURL().then(function(url){
                            ProPicUrl = url;
                            })  
                    }
                    console.log(ProPicUrl);
                    
            });
      }
});
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Getting the download URL from Firebase Storage is (like uploading the data itself) an asynchronous operation. Just like any code that needs to run after the upload has completed needs to be inside the then() block for that task, the code that needs to run after the download URL has been determined has to be inside the then() block for that task too.

So:

const storeref = sRef(storage,"UsersProPic/" + cUserID);
const task = uploadBytesResumable(storeref, ImSRC, metdata).then((snapshot)=>{
        console.log(snapshot);
        function getData(){
                snapshot.getDownloadURL().then(function(url){
                    ProPicUrl = url;
                    console.log(ProPicUrl);
                })  
        }            
});
about 4 years ago · Juan Pablo Isaza Report
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!