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

200
Visualizações
How to properly upload image to Firebase Storage and save link to firestore

Looked at this link How to upload image to firebase storage and save reference in the database in single transaction?, the recommended ones below it, softauthor and a few other sites to find out what I'm doing wrong but none worked. I'm trying to post the image to Storage then update the link in RTDB and Firestore. Here's the snippet, what am I doing wrong? (403 error) + Object { code_: "storage/object-not-found"

updatePfp.addEventListener("change", (e) => {
  file = e.target.files[0];
  var storageRef = firebase.storage().ref("users").child(user.uid);
  storageRef.put(file)
  firebase.storage().ref("users").child(user.uid).getDownloadURL()
    .then(imgUrl => {
      var downloadURL = imgUrl;
      db.collection("userInfo")
        .doc(user.uid)
        .update({
          downloadURL: downloadURL,
        })
        .then(function() {
          alert("saved");
        })
        .catch(function(error) {
          alert(error);
        });
    });
});

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You need to wait until the file has been completely uploaded before you can request its download URL.

storageRef.put(file).then(() => {
  firebase.storage().ref("users").child(user.uid).getDownloadURL()
    .then((downloadURL) => {
      ...
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