question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IFormFile error on ASP.NET Core 2.1 with new ApiControllerAttribute

See original GitHub issue

Post 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:closed
  • Created 5 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found