In a js web project,
I want to POST a form with a complexe json schema, and in which some field will be file.
How do I do It?
I currently upload a file alone like this
const data = new FormData();
data.append('mimetype', file.type);
data.append('filename', file.name);
data.append('file', file);
return this.httpClient.post(url, data)
but I want my new form look like this:
var data ={username:"John doe",
profilPhoto:{mimetype:..., filename:..., file: ...},
house:{
photo:{mimetype:..., filename:..., file: ...},
},
documents:[{mimetype:..., filename:..., file: ...}]
}