Resumable multipart uploads
Enables large uploads to resume from verified server progress while protecting session ownership, part integrity and cleanup boundaries.
multipart-resumable-uploads
See how it helpsWhen is it useful?
Use it when network interruptions or concurrent tabs must not corrupt a file or leave unlimited abandoned upload fragments.
What does it help you do?
- Binds upload sessions and signed parts to their owner.
- Checks actual stored parts or persisted byte offsets before resuming.
- Validates completion, size limits and abandoned-upload cleanup.
Try asking this
Resume a large interrupted upload while rejecting conflicting parallel chunk writes. Interrupt after several verified chunks, reconnect and resend one chunk. Resume from server-confirmed progress and reject mismatched content for an existing part.
Detailed documentation
Read the skill’s original instructions, examples and checks in their authored language.
Show less
Multipart & Resumable Uploads
Single-request uploads (PUT or multipart/form-data) become fragile above 25–100 MB on mobile, Wi-Fi or international connections because a brief network drop forces the user to restart from 0%. Use chunked/multipart or resumable protocols for large files so only the interrupted chunk is retried.
1. S3-Compatible Multipart Upload Lifecycle
Follow the canonical server-coordinated S3 Multipart flow:
- Initiate (
CreateMultipartUpload):- Server validates user permissions and quota, creates a local
upload_sessionsrow (status: 'active',owner_id,tenant_id,storage_key,upload_id,declared_size,part_size,expires_at), and callsCreateMultipartUpload. - Part sizing rule: S3 requires every part except the last to be at least 5 MiB (
5,242,880bytes), with at most10,000parts (1..10000). Choose a dynamic part size (e.g.,8 MiB–64 MiB) based on file size.
- Server validates user permissions and quota, creates a local
- Sign Parts (
UploadPart):- Issue short-lived presigned
UploadPartURLs per part number (or batch of parts), verifying on every request that the authenticated user owns theupload_session. - Include
Content-MD5orx-amz-checksum-sha256per part where supported to detect corruption in transit.
- Issue short-lived presigned
- Resume After Interruption (
ListParts):- When a client reconnects after a drop or page reload, query the session's already-uploaded parts (
ListPartsor local part table) so the client resumes from the first missing part.
- When a client reconnects after a drop or page reload, query the session's already-uploaded parts (
- Complete (
CompleteMultipartUpload):- Client sends the ordered list of
{ PartNumber, ETag }. - Server verifies part count and total size (
HeadObject), callsCompleteMultipartUpload, and transitions the file to'uploaded'/'processing'. - Important: in S3, a completed multipart object's
ETagis<md5-of-part-md5s>-<partCount>(e.g.,"a1b2c3...-4"), not the MD5 of the full file! Usex-amz-checksum-sha256or stream hashing if a full-file cryptographic digest is needed.
- Client sends the ordered list of
- Abort & Bucket Lifecycle Cleanup (
AbortMultipartUpload):- Incomplete multipart parts still consume billable storage until aborted!
- Call
AbortMultipartUploadwhen a user cancels, and configure both an application cleanup job and an S3 Bucket Lifecycle Rule (AbortIncompleteMultipartUploadafter 1–7 days).
2. Resumable Upload Protocols (tus / Content-Range)
When uploads stream through your own server or edge worker (e.g., tus v1.0.0 protocol or HTTP PATCH with Upload-Offset):
- Strict offset verification: before appending bytes on
PATCH, check that the client'sUpload-Offsetmatches the server's current persisted byte offset (409 Conflicton mismatch so the client queriesHEADand resumes from the true offset). - Concurrency lock: lock the upload session row/file handle during an active
PATCHstream so two parallel tabs or retry loops cannot interleave chunks into the same file. - Checksum & max-size enforcement: reject chunks that push
current_offset + chunk_length > Upload-Lengthimmediately.
Included files 1
SKILL.md
