Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

191
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda