I'm wondering how to post files in the request body to an API controller in .NET framework using react. I need to do this without altering the request headers, meaning I need to send it as application/json.
What I need is something like this:
public IHttpActionResult SaveFiles([FromBody] Files[] files)
I've tried this approach, without success:
let formData = new FormData();
images.forEach((image, i) => {
formData.append(i, image);
});
post('/api/returns/savefiles', formData)
.then(response => {...
Any help is much appreciated.