Skip to content
This repository has been archived by the owner on Dec 14, 2018. It is now read-only.

IFormFile is always null when using [ApiController] Attribute in .Net Core 2.1 #8450

Closed
Eilon opened this issue Sep 12, 2018 · 1 comment
Closed

Comments

@Eilon
Copy link
Member

Eilon commented Sep 12, 2018

From @karelz on Wednesday, 12 September 2018 16:20:52

From @skamal-dev on September 12, 2018 13:36

Not sure why this has not been documented or its a bug but whenever we use ApiController attribute in .Net Core 2.1 version, and use the api method signature as ;

[Route("api/[controller]")]
 [ApiController]
 public class UploadFileController : ControllerBase
 {
    [HttpPost]
    public async Task<IActionResult> Post([FromForm] IFormFile file)
    {
    }
}

Whenever we send request from client the parameter "file" is always null, though the Request.Form.Files do contain the parameter details.

Moment I removed [ApiControlller] and send request from the client, I can see the "file" parameter having values.

Copied from original issue: dotnet/corefx#32256

Copied from original issue: dotnet/aspnetcore#3533

@pranavkm
Copy link
Contributor

Dup of #8311

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants