minimal-api-file-upload

Implement secure file upload endpoints for ASP.NET Core minimal APIs.

Updated Aug 26, 2024
One-click install
npx skills add https://github.com/FabienDehopre/my-netatmo-24 --skill minimal-api-file-upload-fabiendehopre
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: minimal-api-file-upload
Source: https://github.com/FabienDehopre/my-netatmo-24/tree/main/.agents/skills/minimal-api-file-upload
Command: npx skills add https://github.com/FabienDehopre/my-netatmo-24 --skill minimal-api-file-upload-fabiendehopre

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill helps developers implement reliable file upload endpoints in ASP.NET Core minimal APIs while avoiding common issues with binding, size limits, validation, and security.

Core Features & Use Cases

  • Multipart Upload Handling: Configure IFormFile and IFormFileCollection uploads for.NET 8+ minimal API endpoints.
  • Security Validation: Apply file size controls, content validation with magic bytes, safe filename handling, and anti-forgery considerations.
  • Large File Streaming: Use MultipartReader workflows when uploads require direct streaming instead of buffered form processing.

Quick Start

Use the minimal-api-file-upload skill to create a secure ASP.NET Core minimal API endpoint that accepts validated image uploads.

Frequently Asked Questions about minimal-api-file-upload

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I handle multipart form file uploads in ASP.NET Core minimal APIs?

Handle multipart form file uploads in ASP.NET Core minimal APIs by binding IFormFile or IFormFileCollection to endpoints. This Skill configures .NET 8+ request processing for validated, buffered file handling.

What is the best way to validate file content and size in minimal APIs?

Validate file content and size by applying strict request size controls and verifying file magic bytes. Safe filename handling and anti-forgery considerations ensure secure file upload storage in ASP.NET Core.

When should I use MultipartReader for large file streaming instead of IFormFile?

Use MultipartReader for large file streaming when uploads require direct streaming instead of buffered form processing. This approach avoids memory exhaustion during massive file uploads in ASP.NET Core minimal APIs.

Does this file upload approach work with .NET 8 minimal API endpoints?

Yes, this approach specifically targets .NET 8+ minimal API endpoints for file uploads. It handles IFormFile binding, request size limits, content verification, and anti-forgery configuration within the minimal API architecture.

Why are my IFormFile uploads failing due to request size limits in minimal APIs?

IFormFile uploads fail when default request size limits are exceeded. You must explicitly configure binding parameters and request size controls in your minimal API to accept large multipart form payloads.