Empty Multipart/form-data (ASPNET CORE)

Asked

Viewed 237 times

1

I am trying to send files to my api via 'POSTMAN', but when the request arrives at the API endpoint 'Iformfile' always comes empty.

POSTMAN

inserir a descrição da imagem aqui

Controller

[AllowAnonymous] //utilizada apenas para teste - alterar para as roles
[HttpPost("UploadFile")]
public async Task<IActionResult> UploadFile([FromForm]IFormFile file)
{
    var teste2 = HttpContext.Request.Form.Files //-> null
    var teste file; //-> null
    var path = Path.GetTempFileName();

    return Ok();
 }

1 answer

1


Hello, the key, in Postman, needs to have the same parameter name, in case file.

  • that’s right, saved me dear vlw

Browser other questions tagged

You are not signed in. Login or sign up in order to post.