file-upload-handling
Implement secure file upload handling with validation, virus scanning, storage management, and serving files efficiently. Use when building file upload features, managing file storage, and implementing file download systems.
By aj-geddes · 462 installs
npx skills add aj-geddes/useful-ai-prompts --skill file-upload-handling
Source repository · Upstream listing
File Upload Handling
Table of Contents
[Overview]( overview)
[When to Use]( when to use)
[Quick Start]( quick start)
[Reference Guides]( reference guides)
[Best Practices]( best practices)
Overview
Build secure and robust file upload systems with validation, sanitization, virus scanning, efficient storage management, CDN integration, and proper file serving mechanisms across different backend frameworks.
When to Use
Implementing file upload features
Managing user uploaded documents
Storing and serving media files
Implementing profile picture uploads
Building document management systems
Handling bulk file imports
Quick Start
Minimal working example:
Reference Guides
Detailed implementations in the references/ directory:
Guide Contents
[Python/Flask File Upload](references/pythonflask file upload.md) Python/Flask File Upload
[Node.js Express File Upload with Multer](references/nodejs express file upload with multer.md) Node.js Express File Upload with Multer
[FastAPI File Upload](references/fastapi file upload.md) FastAPI File Upload
[S3/Cloud Storage Integration](references/s3cloud storage integration.md) S3/Cloud Storage Integration
Best Practices
✅ DO
Validate file extensions and MIME types
Check file size before processing
Use secure filenames to prevent directory traversal
Store files outside web root
Implement virus scanning
Use CDN for file delivery
Generate signed URLs for direct access
Log file upload/download events
Implement access control checks
Clean up temporary files
❌ DON'T
Trust user provided filenames
Store files in web accessible directories
Allow arbitrary file types
Skip virus scanning for uploaded files
Expose absolute file paths
Allow unlimited file sizes
Ignore access control
Use predictable file paths
Store sensitive metadata in filenames
Forget to validate file content