Designing reliable uploads

Mobile system design Senior Kotlin 2.0+ API 24+ Reviewed By Best Latest Apps

Pick the fix

Large video uploads restart from 0% every time the network drops. Fix?

Options
Hint 1 of 1

What does the server need to support?

Choose an answer, then open Show answer below to check it.

Show answer

Answer: A Use resumable or chunked uploads and continue from the last confirmed offset

Correct. Retries resend only what's missing.

Why not the others?
  • B Increase the timeout to an hour. A drop still restarts it.
  • C Upload only on Wi-Fi. Helps, but drops still restart.
  • D Lower the video quality. Smaller, but still restarts.

30-second answer

Copy the photo into app storage and record an upload row in Room. Enqueue unique WorkManager work with a network constraint (unmetered if large), with exponential backoff. Upload in resumable chunks, or with a server-provided upload URL, so retries continue where they stopped. Show progress through WorkInfo, and use a foreground (long-running) worker with a notification for big uploads.

Practise saying it · 40 s. No recording, just a timer

Design reliable uploads.

Say your answer out loud, then check which of these points you covered:

  • Copy file, record in Room
  • Unique WorkManager work
  • Constraints and backoff
  • Resumable chunks
  • Progress and foreground work

Deep dive

Compress or resize before upload when the product allows it.

An idempotency key stops duplicate uploads after a retry.

Keep the original URI permission in mind; copy the file so access doesn't expire.

Let users cancel, and clean up the copy.

Common mistakes

  • Uploading from a ViewModel coroutine that dies with the process.
  • Holding a content URI that loses permission later.
  • Restarting big uploads from zero on every retry.

Senior take & follow-ups

Durability (copy + Room + WorkManager), then resumability and UX.

Follow-up questions

Think of your answer first, then open the hint.

  1. Why copy the file first?

    Show hint

    The picker URI's permission may expire before the upload runs.

  2. How do you show progress?

    Show hint

    setProgress in the worker and observe WorkInfo.

Compare on iOS: Reliable photo uploads iOS hands uploads to background URLSession instead of a worker.

Suggest a fix if something here is wrong or out of date.