insomnia

ASPNetCore - Uploading a file through REST

梦想与她 提交于 2019-11-30 15:29:58
问题 I am using Insomnia for testing an API, but the same happens with Postman. I want to test a file upload, with the following controller: public async Task<IActionResult> Post([FromForm]IFormFile File) If I set the request as a multipart request: it works. However, if I set it as a binary file: I don't know how to get the data. How can it be done? Also, in the controller method's signature, if I change [FromForm] to [FromBody], I'm not getting data. Can someone clarify this for me? 回答1: As you