How to post form-data IFormFile with HttpClient?
问题 I have backend endpoint Task<ActionResult> Post(IFormFile csvFile) and I need to call this endpoint from HttpClient. Currently I am getting Unsupported media type error . Here is my code: var filePath = Path.Combine("IntegrationTests", "file.csv"); var gg = File.ReadAllBytes(filePath); var byteArrayContent = new ByteArrayContent(gg); var postResponse = await _client.PostAsync("offers", new MultipartFormDataContent { {byteArrayContent } }); 回答1: You need to specify parameter name in