Cloudflare images c

Error uploading ERROR 5455: Uploaded image must have image/jpeg, image/png, image/webp, image/gif or image/svg+xml content-type

I was able to solve this by finding out that some libraries don’t put the proper content type for the image in the form data. I was using node fetch, that didn’t work, I was using regular FormData, tried with axios, no luck. Doesn’t work even if you have a blob in there.

formData.append("userpic", file)

Well here’s what worked - using the npm form-data library
import FormData from “form-data”;

formData.append(“file”, fs.readFileSync(../images/${}-0.png), {
contentType: “image/png”,

Content-Disposition: form-data; name="image"; filename="mybook.png"
Content-Type: image/png

This topic was automatically closed after 14 days. New replies are no longer allowed.