advanced
File upload service
Design resumable upload, object storage, metadata, virus scanning, access control, and CDN delivery.
File upload services handle large binaries via direct-to-object-storage uploads using pre-signed URLs or multipart upload APIs, with metadata in a database and async virus scanning. Clients upload chunks in parallel; server assembles ETags and marks file ready after scan.
Access control ties object keys to user or tenant. CDN delivers public assets; private files use signed download URLs. Resumable uploads need session state and part completion tracking.
On interviews: design multipart upload flow, metadata schema, scan pipeline, and CDN delivery for public images.
Common pitfalls: proxying entire file through API servers; no virus scan before sharing link; missing content-type validation allowing XSS via SVG.
The trade-off is flexibility versus complexity—know when the simpler path is enough.
Checklist:
- Pre-signed or multipart direct upload.
- Metadata store separate from blobs.
- Async scan before public availability.
- Signed URLs for private access.