How to upload file image from url in a csv file in a loop? Thanks

I tried more time but not working

This topic has been created from a Discord post (1232452849863229541) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord

for (const imageUrl of refImgs) {
const response = await axios.get(imageUrl, { responseType: “blob” }); // Download image as blob

      const formData = new FormData();
      formData.append("files", response.data, { filename: varName });
      // console.log(`response>>>`, response);

      const uploadResponse =
        await strapi.plugins.upload.services.upload.upload({
          data: {
            fileInfo: {
              name: varName,
              caption: `${row.name}`,
              alternativeText: "Alternative Text",
            },
          },
          files: formData
        });

      console.log(`uploadResponse>>>`, uploadResponse);

I want upload each image url in a loop

because file excell is flat data

this code working!
const uploadImageToStrapi = async (imageData) => {
try {
const formData = new FormData();
formData.append(“files”, imageData, ${new Date().getTime()}.png);

const response = await axios.post(
  "http://127.0.0.1:1337/api/upload",
  formData
);

return response.data[0]; // Assuming Strapi returns the uploaded image information

} catch (error) {
console.error(“Error uploading image to Strapi:”, error);
throw error;
}
};