How to upload the file [FromForm]IFormFile with other parameters which use [FromBody] RRS feed

  • Question

  • Hi, I have an web API the uploads the file [FromForm]IFormFile with other parameters which use [FromBody]. Below is the API.


    public async Task<IActionResult> UploadFileAsync([FromBody]FileProperties, [FromForm]IFormFile file)



    Upon testing using postman or swagger, it's always returning 415Unsupported Media Type. 

    Questions are:

    1) Is it possible in the api that contains FromBody and FromForm parameters?

    2) Or, did I test it correctly using postman? How to test in postman? In post mean I added Content-Type: multipart/form-data in header, and in body I selected form-data and there I have key of file which is file type and the rest are just text. Please help me as I need to resolve this ASAP tomorrow. Thanks in advance.

    • Moved by CoolDadTx Thursday, September 19, 2019 5:21 PM ASP.NET related
    Thursday, September 19, 2019 1:05 PM

All replies