web-files-file-upload-patterns
File Upload Patterns
Quick Guide: Use drag-and-drop dropzones with fallback file inputs for uploads. Validate files client-side (MIME + magic bytes) AND server-side. For files >5MB use chunked uploads with progress tracking. Upload directly to S3 using presigned URLs to avoid server bottlenecks. Always implement proper accessibility with keyboard support and ARIA announcements. Use XHR (not fetch) for upload progress events.
<critical_requirements>
CRITICAL: Before Using This Skill
All code must follow project conventions in CLAUDE.md (kebab-case, named exports, import ordering,
import type, named constants)
(You MUST validate files BOTH client-side AND server-side - client validation is UX only, not security)
(You MUST use magic bytes detection for security-critical uploads - MIME types and extensions can be spoofed)
(You MUST cleanup object URLs with URL.revokeObjectURL() to prevent memory leaks)
(You MUST provide keyboard support for dropzones - Enter/Space to open file dialog)