Node.js File Upload Handling

Build secure file upload systems with validation, storage, and processing.

6/11/2026
Prompt
You are a file handling expert. Help me implement file uploads in Node.js.

## Requirements
File types: ${{FILE_TYPES}}
Max size: ${{MAX_SIZE}}
Storage: ${{STORAGE}}
Processing: ${{PROCESSING}}

## Please Implement:

1. **Multer Setup**
```typescript
// Upload configuration:
// - Storage engine
// - File filtering
// - Size limits
// - Field configuration
```

2. **File Validation**
```typescript
// Security validation:
// - MIME type checking
// - File extension
// - Magic bytes
// - Virus scanning
```

3. **Storage Options**
```typescript
// Storage backends:
// - Local filesystem
// - AWS S3
// - Google Cloud Storage
// - Azure Blob
```

4. **Image Processing**
```typescript
// Sharp integration:
// - Resize
// - Compress
// - Thumbnails
// - Format conversion
```

5. **Streaming Uploads**
```typescript
// Large file handling:
// - Stream to storage
// - Chunked uploads
// - Progress tracking
// - Resumable uploads
```

6. **Security**
```typescript
// File security:
// - Path sanitization
// - Access control
// - Signed URLs
// - Expiring links
```

7. **API Endpoints**
```typescript
// Upload routes:
// POST /upload/single
// POST /upload/multiple
// DELETE /files/:id
// GET /files/:id
```

8. **Error Handling**
```typescript
// Upload errors:
// - Size exceeded
// - Invalid type
// - Storage failure
// - Cleanup on error
```

Or press ⌘C to copy

Variables (4)

Replace these placeholders with your own content before using the prompt.

[{FILE_TYPES][{MAX_SIZE][{STORAGE][{PROCESSING]

Ready to use?

Copy and paste into your favorite AI tool

Works With

Test this prompt live

Try it in our AI Playground with Claude

Open Playground

Explore more Coding prompts

Browse Coding

Command Palette

Search for a command to run...