You mean like this?
const uploadByUrl = async () => {
URL = "https://images.unsplash.com/photo-1611095785020-1ba3dd228ea7?ixid=MXwxMjA3fDF8MHxlZGl0b3JpYWwtZmVlZHwxfHx8ZW58MHx8fA%3D%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=900&q=60"; // <- image url
fetch(URL)
.then(response => response.blob())
.then(function (myBlob) {
const formData = new FormData();
formData.append('files', myBlob);
console.log(formData)
fetch('http://localhost:1337/upload', {
method: 'POST',
headers: {
"Authorization": "Bearer ", // <- Don't forget Authorization header if you are using it.
},
body: formData,
}).then((response) => {
const result = response.json()
console.log("result", result)
}).catch(function (err) {
console.log("error:");
console.log(err)
});
})
}
uploadByUrl()