Uploading images directly from react native app

For Workes & Pages, what is the name of the domain?

freshlyapp.live

What is the error number?

5400

What is the error message?

Bad request: Error parsing form fields

What is the issue or error you’re encountering

No official doc for direct creator upload API from a react native app

What steps have you taken to resolve the issue?

This is the part of the code:

const cloudflareUrl = https://api.cloudflare.com/client/v4/accounts/${CLOUDFLARE_ACCOUNT_ID}/images/v2/direct_upload;

        const formData = new FormData();
        formData.append('requireSignedURLs', 'true');
        formData.append('metadata', JSON.stringify({
            sku: storeSku.skuId,
        }));

        // convert the local image to a blob
        const responseBlob = await fetch(image.uri);
        const fileBlob = await responseBlob.blob();

        // append the fileBlob to formData
        formData.append('file', fileBlob, 'upload.jpg');

// Send the request to Cloudflare
const response = await fetch(cloudflareUrl, {
method: ‘POST’,
headers: {
‘Authorization’: Bearer ${CLOUDFLARE_API_TOKEN},
},
body: formData,
});

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