I'm trying to make a POST request that sends files to a controller method with the following definition
public async Task<ActionResult> PostUploadFilesAsync([BindRequired, FromForm] IEnumerable<IFormFile> files)
But 'files' is always empty when it receives the request.
I've tried a few different ways of posting it, and this is my current attempt at building up the request. The files I'm sending have been uploaded to my own controller and seem fine at that point.
var client = new HttpClient();
var content = new MultipartFormDataContent();
MemoryStream ms = new MemoryStream();
await Request.Form.Files[0].CopyToAsync(ms);
content.Add(new StreamContent(ms));
var address = <the-address>;
var result = client.PostAsync(address, content);
I can't figure out why the files are not being received. Thanks