B K B K -4 years ago 200
Android Question

"Unrecognized FormData part." error on React native (android) Video upload with XMLHttpRequest

I am trying to upload a video to cloudinary and the below code works on ios but getting an error on Android almost instantly when the upload starts, the error being

Unrecognized FormData part.

let {api_key, api_secret, cloud_name, url} = CLOUDINARY_CONFIG;
let timestamp = (Date.now() / 1000 | 0).toString();
let hash_string = `eager_async=true&folder=${endpoint}&timestamp=${timestamp}&use_filename=true${api_secret}`;
let signature = CryptoJS.SHA1(hash_string).toString();
let formData = new FormData();
formData.append('timestamp', timestamp);
formData.append('api_key', api_key);
formData.append('signature', signature);
formData.append('eager_async', true);

formData.append('file', {uri: body.uri, type: 'video/mp4', name: `video_${timestamp}.mp4`});
formData.append('eager', [{width: 720}]);

formData.append('folder', endpoint);
formData.append('use_filename', true);
let xhr = new XMLHttpRequest();
xhr.open('POST', url);

xhr.onerror = (event) => {
type: failureType,


Initially the
had an invalid path and it need a prefix of

Answer Source

Found the solution, problem was not to set the width which worked on iOS for some reason.

Removing the line formData.append('eager', [{width: 720}]); fixed the issue.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download