How to upload Audio or generic filetype


for some reason posting an audio file as multipart/form-data doesn’t work the payload shows up as [object object]. below is a snippet where i get a signed url from google storage then post the form data to it, everything works but the request body is just [object object] instead of form data.

const data = new FormData()

    const meta = {
      uri, // "file://dsfsdfd/sfsfsd.caf"
      name: 'something.caf',
      type: 'audio/caf',
    data.append('file', meta)
    console.log('data pre send', data)
    try {
      const response = await fetch(`${signed_url}`, {
        body: data,
        method: 'PUT',
        headers: {
          'Content-Type': 'multipart/form-data',
      console.log('upload', response) // success
    } catch (e) {
      console.log('no upload', response)

  postImageToServer = (ticketId, params) => {
    return axios
      .post(`/tickets/${ticketId}/imageUpload`, params)
      .then(response =>, () => (this.state = 'error'))

it works, there is a bug in your code somewhere, see this example

1 Like

I’m not sure what I’m doing wrong everything looks right excpet the request body being [object object]
49 PM


perhaps turn off chrome debugging

1 Like

I have tried, I use a CORs pluging when it is on, and get a 200 response (not a resource policy warning)


I tried setting up a snack but it doesn’t seem to work


does work for you?


Hey yes it works,
I guess it’s just images.
Tried modifying it for audio


the example you shared doesn’t do anything - what is sound.caf? there is no such file. further, the backend that you’re using (the one from the example repo) is specifically intended for images:


sound.caf is an audio file created with expo. it can be seen in the left under the files of the snack… Let’s close off this issue, I’ll explore some alternative solutions…


You were right the remote debugging tools with the CORs plugin were malforming the request. Thank you for the help.