I am trying to upload multiple files (documents) with additional data per file. Ie. I would like to upload multiple documents like this:
[{
documentFile: file
documentVersion: 2,
documentOperation: "createNew"
...
},
{
documentFile: file2.doc
documentVersion: 1,
documentOperation: "createNew"
...
}]
And ideally would like that information to be populated in the model but this is not a requirement.
I am using Aurelia Fetch client to send data using FormData.
Is this possible?
If your model is like:
public class Documents
{
public IFormFile documentFile { get; set; }
public string documentVersion { get; set; }
public string documentOperation { get; set; }
}
You can see my test.
Action:
[HttpPost]
public IActionResult Demo(List<Documents> documents)
{
//...
}
Send data by postman:
Result: