Do not proxy the bytes through your API. Have the client request a presigned upload URL, upload directly to object storage with multipart upload for large files, and then notify your service, which verifies the object and records metadata. Validate content type and size limits at the policy level, scan asynchronously before the file is usable, and generate short lived signed URLs for downloads rather than making objects public.
Why interviewers ask this
It is a design question that surfaces a lot at once: streaming versus buffering, storage choice, security and asynchronous processing. The interviewer wants you to avoid the naive design where a request thread holds two gigabytes, and to think about validation and resumability. The security follow ups, on presigned URL scope and untrusted file content, separate careful engineers from people who just made it work.
How to structure your answer
- Keep the bytes out of your application: direct to object storage.
- Describe the flow: presign, multipart upload, completion callback.
- Cover validation, virus scanning and how the file becomes usable.
- Handle downloads with short lived signed URLs and access checks.
Example answer
The first decision is that the file never goes through my API, because two gigabytes through a request handler ties up a worker, costs bandwidth twice and breaks the moment a connection drops. So the client asks my service for a presigned upload URL, scoped tightly to one key, one content type and a short expiry, and uploads directly to object storage. For files this size I use multipart upload, which gives me resumability, since a failed part is retried instead of the whole file. When the upload completes the client calls back, or better, storage emits an event, and my service verifies the object exists and matches the expected size before writing metadata. The file starts in a pending state and only becomes usable after asynchronous processing: scanning, checking the real content type from the bytes rather than trusting the extension, and generating any thumbnails. Downloads go through a short lived signed URL issued after an authorization check, never a public bucket, which is where a surprising number of data leaks come from.
Walking into this interview soon? GhostPilot listens to your live call, spots the question the moment it is asked, and puts a structured answer on your screen in real time. Try it on your next mock, or grab a $29 Session Pass, no subscription, for the real thing.
See how it worksFollow-up questions to expect
- How do you stop someone using a presigned URL to upload something else?
- How would you handle a client that disappears mid upload?
- How would you support resumable uploads on a flaky mobile connection?
Related backend developer questions
Your interviewer will ask their own version of this. Paste your actual job description into the free Question Predictor and get the 20 questions that role is most likely to ask, with what each one is really probing.
Predict my questions