Convert File To Byte Array Buffer

Is there a way to convert the URI received when you create a new Audio file using the Audio API to record sound? I’m able to successfully record an audio clip, but I’ve been unable to figure out how to read the file into a byte array buffer compatible with Cloudinary cloud storage.
The Cloudinary documentation I’m trying to follow is highlighted in the image below:

Hey reggie - I’m not familiar with Cloudinary, but have you tried using a FormData object to upload? There’s an example here you can refer to: . It involves uploading images, but would work just the same with audio files. Hope this helps!

@esamelson, I did look at that example, but was unable to figure out what the uri value is in this portion of code on lines 175-120 in App.js

let formData = new FormData();
  formData.append('photo', {
    name: `photo.${fileType}`,
    type: `image/${fileType}`,

Do you know the that is passed to the backend when the uri is included like it is in the example?

In case anybody else has the same problem, I was able to upload to Cloudinary by creating the following FormData Object and sending it using fetch (though, I assume any API utility library will work):

formData = new FormData();
    formData.append('api_key', CLOUDINARY_API_KEY);
    formData.append('file', {
      uri: fileUploadData.URI,
      name: fileUploadData.URI.split('/').pop(),
      type: fileUploadData.type
    formData.append('timestamp', getSignatureAPIResponse.response.timeStamp);
    formData.append('signature', getSignatureAPIResponse.response.signature);
    formData.append('public_id', fileUploadData.publicID);
    formData.append('folder', fileUploadData.folder);

fileUploadData is an object holding data about the file, and getSignatureAPIResponse.response contains the information required in order to do signed uploads

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.