IFormFile error on ASP.NET Core 2.1 with new ApiControllerAttribute
See original GitHub issuePost API method with IFormFile parameter generate 400 BadRequest with new ApiControllerAttribute.
Works if I remove attribute or I disable InferBindingSourcesForParameters with
services.Configure<ApiBehaviorOptions>(options => { options.SuppressInferBindingSourcesForParameters = true; });
Tested with SwaggerUI and TypeScript generated client. Same error.
API method:
[HttpPost]
public IActionResult Update(IFormFile file)
{
return NoContent();
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
IFormFile always return null in asp.net core 2.1
IFormFile could be null if app is hosted by Kestrel server and file size exceeds 28.6MB. To see if that's the case, check...
Read more >Create web APIs with ASP.NET Core
Problem details for error status codes. Attribute on specific controllers. The [ApiController] attribute can be applied to specific controllers, ...
Read more >Upload files in ASP.NET Core
IFormFile is a C# representation of the file used to process or save the file. The disk and memory used by file uploads...
Read more >How To Upload Files With .NET Core Web API and Angular
In this article, we are going to learn how to upload files with .Net Core Web API and Angular. We are going to...
Read more >Better file upload integration with Swagger on Minimal APIs
These framework provided interfaces IFormFile to upload a file and handle it server-side and IFormFileCollection to handle several files.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@RSuter
@pranavkm It works with compat version 2.1, thanks 👍
It would be convenient to mention it in the documentation of NSwag.