For Workers & Pages, what is the name of the domain?
What is the issue or error you’re encountering
Unable to set the name of the image (not id)
What steps have you taken to resolve the issue?
I tried setting the field filename using the code below but I get the error 5400 “Error parsing form fields”
What are the steps to reproduce the issue?
I am trying to upload an image from the url using the following code:
import { Cloudflare } from “cloudflare”;
const client = new Cloudflare({
apiToken: process.env[“CLOUDFLARE_IMAGES_TOKEN”],
});
export const uploadStockImage = (url, image_id, folder) => {
return new Promise(async (resolve, reject) => {
try {
const id = ${folder}/${image_id}
;
await client.images.v1.create({
account_id: process.env.CLOUDFLARE_ACCNT_ID,
id,
url,
});
resolve(true);
} catch (err) {
console.log(err);
reject(err);
}
});
};
It sets the image id as expected but the name of the image name is set with the last part of the url (see screenshot). Is it possible to set the name by modifying the code above?