0

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?

1 Answer 1

1

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:

enter image description here

Result:

enter image description here

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.