file-handling

Implement secure file uploads and streaming in ASP.NET Core Razor Pages.

10|Updated Jan 28, 2026
One-click install
npx skills add https://github.com/AGIBuild/Agibuild.Fulora --skill file-handling-agibuild
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: file-handling
Source: https://github.com/AGIBuild/Agibuild.Fulora/tree/main/.cursor/skills/file-handling
Command: npx skills add https://github.com/AGIBuild/Agibuild.Fulora --skill file-handling-agibuild

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill requires Microsoft.AspNetCore.WebUtilities, SixLabors.ImageSharp, Azure.Storage.Blobs, MimeTypes, and includes scripts (resource) and references (resource) components.

What problem does it solve?

This Skill provides robust patterns for securely handling file uploads, streaming large files efficiently, abstracting storage solutions, and implementing secure downloads in ASP.NET Core Razor Pages applications.

Core Features & Use Cases

  • Secure File Uploads: Validates file types, sizes, and content using magic numbers to prevent malicious uploads.
  • Large File Streaming: Uploads large files directly to storage without consuming excessive memory.
  • Storage Abstraction: Supports interchangeable storage backends like local file systems or Azure Blob Storage.
  • Secure Downloads: Ensures files are downloaded with proper authorization and content disposition.
  • Image Processing: Includes capabilities for resizing and optimizing image uploads.
  • Use Case: Securely upload user-submitted documents, stream large video files to cloud storage, and provide authenticated download links for generated reports.

Quick Start

Implement a secure file upload endpoint in your Razor Pages application by integrating the provided FileUploadValidator and IFileStorageService.

Frequently Asked Questions about file-handling

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

FAQPage Schema
How do I securely handle file uploads in ASP.NET Core Razor Pages?

Secure file uploads in ASP.NET Core are handled by validating file types and sizes using magic numbers to prevent malicious uploads. This approach checks file content rather than extensions to mitigate security vulnerabilities and memory exhaustion.

What is the best way to stream large file uploads to Azure Blob Storage without running out of memory?

Streaming large file uploads directly to Azure Blob Storage avoids excessive memory consumption. This technique uploads files directly to storage without buffering the entire payload in memory, preventing memory exhaustion during large file operations.

How does magic number validation work for file uploads?

Magic number validation secures file uploads by reading the specific byte signatures at the beginning of a file to verify its true content type. This prevents malicious uploads disguised with trusted file extensions from bypassing standard validation checks.

Can I use this file handling approach with both local file systems and Azure Blob Storage?

Yes, the file handling approach uses a storage abstraction that supports interchangeable storage backends. You can seamlessly switch between local file systems and Azure Blob Storage using a pluggable IFileStorageService without changing core upload logic.

How do I implement secure file downloads with proper authorization in ASP.NET Core?

Secure file downloads in ASP.NET Core ensure files are served with proper authorization checks and correct content disposition headers. This prevents unauthorized access while guaranteeing files are downloaded rather than rendered inline by the browser.

How do I resize and optimize image uploads during the file upload process?

Image processing during file uploads resizes and optimizes images using the SixLabors.ImageSharp library. This capability is integrated directly into the upload pipeline, ensuring images are efficiently processed before being saved to storage.