I am developping a form with some basic inputs and a mini form (in a popup) with a list of foos and each foo have its own attachement file
{
// form fields
...
foos: [
{
// foo form fields
...
attachment: { /* File type */ }
},
...
]
}
before i add the attachement property (file upload), everything work good when i submit the whole form with axios
to the backend api server (i am using redux-form
to manage the form state)
I use JSON.stringify(formValues)
to send data with axios
as json
But when i add the attachement property i don't know how to send the form because i read that with the file involved in the form i can't no longer send the form as json but I have to use FormData
The problem is I have nested file objects within a list so how can i send the whole form ?