web-files-file-upload-patterns
Installation
SKILL.md
File Upload Patterns
Quick Guide: A dropzone is a keyboard-operable button wrapping a hidden file input, with drag as an enhancement. Validate for the user's benefit on the client — extension, MIME type, then the file's own magic bytes — and again on the server, because none of the client checks are security. Progress needs
XMLHttpRequest;fetchhas no upload progress event. Past roughly 100MB, chunk the file so a failure costs one chunk. Large files go straight to storage on a presigned URL the server issues, so no request body is ever proxied.
Detailed Resources:
- examples/core.md — file input, dropzone, file list state and rendering, the assembled component
- examples/validation.md — rule-based validator, magic-byte detection, dimension checks, a validation hook
- examples/progress.md — XHR progress with speed and ETA, progress bar, formatters, concurrent uploads
- examples/preview.md — a preview thumbnail for a selected file, with cleanup
- examples/presigned-upload.md — PUT and POST-policy uploads, the server contract, multipart parts, the whole flow as a hook
- examples/resumable.md — chunked uploader with retry, resume across a reload, a tus client, the tus server contract
- examples/accessibility.md — announcing selection and progress, focus return after the file dialog
- reference.md — method selection by size, expiry guidance, validation order, CORS, review checklist