Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

268
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!