Upload image url

Has anyone successfuly implemented this? Trying to get it done in v4, to seed my strapi db from another CMS, with no luck so far. I had an implementation for v3 where I downloaded the files to my fs then uploaded them and it worked, would be nice to skip the writting to system part… :slight_smile:

Here is my blob implementation, heavily inspired from above. after raising the file size limits in the middleware.js file. I’m still getting a 400 error “files are empty”

async function uploadByUrl(imageurl) {
  try {
    console.log("hello", imageurl);
    const image = await fetch(imageurl);
    const imagetoUpload = await image.blob();
    console.log(imagetoUpload.type);
    const arrayBuffer = await imagetoUpload.arrayBuffer();
    const buffer = Buffer.from(arrayBuffer);

    const formData = new FormData();
    formData.append("files", buffer);

    const uploadedBlobToStrapi = await fetch(
      "http://localhost:1337/api/upload",
      {
        method: "POST",
        headers: {
          authorization: `Bearer ${STRAPI_TOKEN}`,
        },
        body: formData,
      }
    );
    const results = await uploadedBlobToStrapi.json();
    return results;
  } catch (error) {
    console.log(error.message);
  }
}