How to get text data from FormData?

I need to upload a file and then update the db that’s why i need to get the text data on formdata.

For me to upload on an s3 bucket I need to set the processManually to the route i am using for ex. i set it to processManually: ['/organisations'] that uploading part is good now.

but now I cannot get the text data from FormData.

I tried everything, request.raw, request.all, etc etc. I am not sure what to do now.

// config/bodyParser.js

...
  files: {
    types: [
      'multipart/form-data'
    ],

    maxSize: '20mb',

    autoProcess: true,

    processManually: ['/organisations']
  }
...

// FormData sent

{
 id: 1,
 name: 'yehey',
 img: (binary)
}

I need to get the name and id

1 Like

You can use this to retrieve the text data:

const requestBody = {}
await request.multipart.field((key, value) => {
requestBody[key] = value
})

1 Like