Cursor prompt

Add File Upload with Cloud Storage

Multi-file upload with type checking, size limits, virus scanning, cloud storage, and progress tracking.

Implement file upload for {{project_name}}.

## Storage: {{storage_provider}}
## Allowed file types: {{allowed_types}}
## Max file size: {{max_size}}

### Client-Side Upload Component
- Drag-and-drop zone with click-to-browse fallback
- Show file name, size, type icon, and upload progress bar per file
- Validate file type and size before upload attempt (fail fast client-side)
- Support multiple simultaneous uploads with individual progress
- Allow removal of queued/failed files before or during upload

### Upload Flow (Presigned URL Pattern)
1. Client requests presigned URL: POST /api/upload/presign { filename, contentType, size }
2. Server validates: type allowlist, size limit, user quota
3. Server generates presigned PUT URL with {{expiry_minutes}}-minute expiry
4. Client uploads directly to {{storage_provider}} using presigned URL
5. Client confirms upload: POST /api/upload/confirm { key, filename, size }
6. Server records file metadata in DB

### Server Validation (Defense in Depth)
- Verify Content-Type matches file extension
- Check file signature (magic bytes) not just extension
- Apply per-user quota: max {{user_quota}} of storage
- Scan for malware using {{scanner}} if configured

### Database
Store: id, userId, filename, key (storage path), contentType, size, uploadedAt, status

### Access Control
- Signed download URLs (expiring) for private files
- Never expose direct S3 paths to clients

### Output
Upload component, presign API route, confirm route, file record model, and download URL helper.

Fill in: {{project_name}}, {{storage_provider}}, {{allowed_types}}, {{max_size}}, {{expiry_minutes}}, {{user_quota}}, {{scanner}}. In Loopy you fill these in a form and copy the finished prompt in one click.