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

263
Visualizações
how to upload list of images to firebase storage and get all the urls

I am using firebase storage to upload the images and then store the urls to firebase db. I am using that to upload the list of images but the code below works fine in firebase v8 but not in version 9

export const multiImageUpload = async (path = "Products", imageFileList) => {
  let imagesUrlArray = [];
  let imageUrl = "";
  // array of files
  let arr = imageFileList.map((item) => {
    return item.originFileObj;
  });

  for (let i = 0; i < arr.length; i++) {
    const upload = await storage.ref(`/${path}/${arr[i].name}`).put(arr[i]);
    imageUrl = await upload.ref.getDownloadURL();
    imagesUrlArray.push(imageUrl);
  }

  return imagesUrlArray; // array of URLS of uploaded files
};

it throws error that ref.put is not a function please guide me why I am getting that error.

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

0

import { ref, getDownloadURL, uploadBytesResumable, uploadBytes } from 'firebase/storage';

// Upload the multiple images
        const multiImage = async (imageFileList) => {
            /* eslint no-var: 0 */
            const imagesUrlArray = [];
            /* eslint no-var: 0 */
            for (let i = 0; i < imageFileList.length; i++) {
                const id = uuidv4();
                const metadata = {
                    contentType: 'image/jpeg'
                };
                /* eslint-disable no-await-in-loop */
                const storageRef = ref(storage, `images/${id}`);
                const upload = await uploadBytes(storageRef, imageFileList[i], metadata);
                const imageUrl = await getDownloadURL(storageRef);
                imagesUrlArray.push(imageUrl);
            }
            return imagesUrlArray; // array of URLS of uploaded files
        };
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