How to create/upload an image from the backend from a URL

Hey all,

I have a list of image URLs I’d like to upload programatically, following the current strapi docs for uploading files through a controller I manage to make this:

    const file = await fetch(url)
      .then((res) => res.blob())
      .then((res) => new File([res], url));
    const uploadedFile = await{
      data: {},
      files: file,


But I get an error that “path” is undefined, I could see from the source code that it expects that the file passed has a path attribute, but I don’t know what that’s supposed to be, basically the problem here is I don’t know what type/shape it expects.

You can also upload image using the help of Strapi’s Upload plugin. The endpoint for ‘Post’ method is ‘/api/upload’

For details, you may also refer to the documentation from Upload | Strapi Documentation