Howdy,
I’m trying to use a Direct Creator Upload URL to upload images client side using Axios. My code looks basically like this:
const onDrop = (acceptedFiles) => {
axios
.post("/api/v1/services/cloudflare/direct-upload")
.then(async ({ data }) => {
let formData = new FormData();
formData.append("file", acceptedFiles[0]);
await axios.post(data.result.uploadURL, formData, {
headers: { "Content-Type": "multipart/form-data" },
});
});
};
This works, the image is successfully uploaded and visible in the Cloudflare dashboard UI, however it throws a CORS error every time, and I am unable to get any callback data from the post to data.result.uploadURL, regardless of the successful upload.
I may be misusing this flow, but my hope is to get the Cloudflare result callback and attach that to related data that I’ll be storing. I would regardless expect a 200 response since it is uploading the file as expected.
