minimal-api-file-upload
SolidFile upload endpoints in ASP.NET minimal APIs (.NET 8+)
Data & Documents 3,357 stars
247 forks Updated today MIT
Install
Quality Score: 93/100
Stars 20%
Recency 20%
Frontmatter 20%
Documentation 15%
Issue Health 10%
License 10%
Description 5%
Skill Content
# Implementing File Uploads in ASP.NET Core Minimal APIs
## When to Use
- File upload endpoints in ASP.NET Core minimal APIs (.NET 8+)
- Handling IFormFile or IFormFileCollection parameters
- When you need size limits, content type validation, or streaming large files
## When Not to Use
- MVC controllers → `[FromForm] IFormFile` works directly with attributes
- Simple JSON body → no file upload needed
- Very large files (> 1GB) → use streaming with `MultipartReader` instead
## Inputs
| Input | Required | Description |
|-------|----------|-------------|
| File parameter(s) | Yes | IFormFile or IFormFileCollection |
| Size limits | Yes | Max file/request size |
| Allowed types | No | Content type or extension restrictions |
## Workflow
### Step 1: CRITICAL — Understand IFormFile Binding in Minimal APIs
```csharp
// In .NET 8+ minimal APIs, IFormFile binds automatically from multipart/form-data
// when it is the only complex parameter.
app.MapPost("/upload", (IFormFile file) => ...);
// CRITICAL: When you mix files with other form fields, use [FromForm] on all
// form-bound parameters (or group them into a single [FromForm] DTO).
app.MapPost("/upload-with-metadata",
([FromForm] IFormFile file, [FromForm] string description) =>
{
return Results.Ok(new { file.FileName, Description = description });
});
// Multiple files: IFormFileCollection also binds automatically from multipart/form-data.
// You only need [FromForm] if you mix it with other form fields, as shown...
Details
- Author
- dotnet
- Repository
- dotnet/skills
- Created
- 4 months ago
- Last Updated
- today
- Language
- C#
- License
- MIT
Similar Skills
Semantically similar based on skill content — not just same category
API & Backend Solid
aspnet-minimal-api-openapi
Create ASP.NET Minimal API endpoints with proper OpenAPI documentation
34,887 Updated today
github API & Backend Listed
aspnet-api-patterns
ASP.NET Core API patterns — controllers vs minimal API, middleware, error handling, versioning, and authentication setup.
3 Updated 4 days ago
zdanovichnick API & Backend Listed
neo-dotnet-minimal-apis
Use this skill when building, debugging, refactoring, or reviewing ASP.NET Core Minimal APIs, lightweight endpoints, route groups, endpoint filters, typed results, OpenAPI metadata, or high-performance .NET API services without controllers.
5 Updated yesterday
Benknightdark