File Uploads and Object Storage
Upload resumes and images safely using object storage, signed URLs, validation and image processing.
Advanced · about 4 hours · difficulty 3/5
Learn first: Authorization and Access Control, Environments, Config and Secrets
Resumes, profile photos and offer letters should not live on your server's disk or in your database. They belong in object storage such as Amazon S3, Cloudflare R2, Supabase Storage or Cloudinary for images.
The signed upload pattern
- The client asks your API for permission to upload, with file name, type and size.
- Your server checks auth and validation, then returns a short-lived pre-signed URL.
- The browser uploads directly to storage, bypassing your server.
- The client confirms, and you save the file key (not a public URL) in PostgreSQL.
Safety
- Validate type and size on the server, not just in the browser input.
- Keep private files (resumes) in private buckets and serve them through signed download URLs that expire.
- Generate your own random keys; never trust the user's file name.
- Scan or process images server-side (resize, strip metadata) when needed.
Pitfalls
- Public buckets containing personal documents.
- Uploading through serverless functions that hit body size limits.
- Storing files as base64 blobs in the database.
You are ready to move on when students can upload a PDF resume through a signed URL to a private bucket, and only the student and authorised recruiters can download it.
Key concepts
- Object storage basics
- Pre-signed upload URLs
- Private files and signed downloads
- Type and size validation
- Image resizing and CDNs
- Cloudinary or Supabase Storage
Mini project
Add resume upload to your portal using pre-signed URLs to a private S3-compatible bucket (Cloudflare R2 or Supabase Storage), with server-side validation and expiring download links for recruiters.
Check yourself
Why upload directly from the browser to storage using a signed URL instead of streaming the file through your API?
Free resources
- Amazon S3 User Guide (AWS)
- Cloudflare R2 (Cloudflare)
- OWASP File Upload Cheat Sheet (OWASP)