E
Elezard
Guest
Hi, I have an web API the uploads the file [FromForm]IFormFile with other parameters which use [FromBody]. Below is the API.
[Produces("application/json")]
[Consumes("multipart/form-data")]
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.
Continue reading...
[Produces("application/json")]
[Consumes("multipart/form-data")]
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.
Continue reading...