Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

198
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda