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

144
Visualizações
Get image from firebase storage

I'm building a blog where an authenticated user should be able to include an image in a post. I have read all documentation provided by firebase but the only solution I find is to provide the name of the image stored.

The problem is that I don't know what the name of the image will be so I'm looking for a solution where I could use e.target or something to pick the correct image.

Right now, I'm only able to fetch an image if I provide the name of the image in the storage.

const uploadImage = () => {
    if (image == null) return;
    const imageRef = ref(storage, `images/${image.name}`);
    uploadBytes(imageRef, image).then((snapshot) => {
      getDownloadURL(snapshot.ref).then((url) => {
        setImageUrls((prev) => [...prev, url]);
      });
    });
  }; 
  useEffect(() => {
    const fetch = async () => {
      const storage = getStorage();
      const img = ref(storage, `images/${image.name}`); // not working
      await getDownloadURL(img).then((x) => {
        setUrl(x);
      });
    };
    if (url === undefined) {
      fetch();
    }
  }, []);
about 4 years ago · Santiago Gelvez
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