Build Secure File Upload Handler
Generate secure, production-ready file upload handlers with validation, storage, and error handling for your backend application.
Prompt Template
Variables to Customize
[PROGRAMMING_LANGUAGE] Backend programming language to use
Example: Node.js
[FRAMEWORK] Web framework for the implementation
Example: Express.js
[FILE_TYPES] Allowed file types for upload
Example: images (JPEG, PNG, WebP) and PDF documents
[UPLOAD_METHOD] Single or multiple file upload support
Example: multiple file uploads
[MAX_FILE_SIZE] Maximum allowed file size
Example: 10MB
[STORAGE_LOCATION] Where to store uploaded files
Example: local filesystem with organized folder structure
[DATABASE_TYPE] Database system for file metadata
Example: MongoDB
Example Output
Pro Tips for Best Results
- Always validate file types using magic numbers/headers, not just extensions, to prevent security vulnerabilities
- Implement proper error handling for edge cases like storage full, network interruptions, and corrupted files
- Use unique filenames (UUIDs) to prevent conflicts and potential security issues with user-provided names
- Set appropriate file size limits and implement streaming for large files to prevent memory issues
- Consider implementing virus scanning and content analysis for production applications handling user uploads
Tags
Want 500+ Expert Prompts?
Get the Premium Prompt Pack — organized, tested, and ready to use.
Get it for $29Related Prompts You Might Like
Generate REST API Endpoints with Documentation
You are an experienced backend developer tasked with creating REST API endpoints for a [APPLICATION_TYPE] application. D...
Create Responsive CSS Layout
Create a responsive CSS layout for [LAYOUT_TYPE] with the following specifications: Layout Requirements: - Type: [LAYOU...
Create Optimized Database Indexes
You are a senior database administrator with expertise in query optimization and index design. I need you to create opti...
Write Comprehensive Technical Specifications
You are a senior technical architect tasked with creating comprehensive technical specifications. Write a detailed techn...
Implement Data Serialization for APIs
You are an expert backend developer specializing in data serialization for APIs. I need you to implement a complete data...
Debug Async JavaScript Issues
You are an expert JavaScript debugger specializing in asynchronous code issues. I need help debugging async JavaScript p...