Images API Upload via URL

HI! can somebody help me to sort this out? please?
This is my first time using Cloudflare. I need to upload images using URLs.
like there

I read the docs and tried to make a request. But I keep getting an error

‘ERROR 5415: Images must be uploaded as a form, not as raw image data. Please use multipart/form-data format’

there is my code

const formdata = new FormData();
formdata.append(‘url’, “https://filepath”, “image.jpg”)

await axios({
method: “POST”,
headers: {
Authorization: Bearer ${apiToken}',
body: formdata

tell me what i’m doing wrong

Make sure you’re adding the right Content-Type header - the examples use curl and it wouldn’t surprise me if it just implicitly added the headers when you use --form

Content-Type: multipart/form-data

1 Like

thank you, everything worked out! You saved my day!


This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.