GROW WITH ATARAXYBuild skills. Get real experience.Explore internships and education support.

MVPs & SaaS Projects

SaaS Multipart Uploads: Reconcile Completion and Clean Up Abandoned Parts

Coordinate S3 multipart uploads with durable application records, verified completion, uncertain-response recovery, and cleanup of abandoned parts.

LET’S BUILD SOMETHING USEFUL

Have a project in mind?

Talk to Ataraxy Developers about your website, app, or custom software.

A large upload reaches one hundred percent in the browser, but the SaaS application never shows the file. In another case, a customer closes the tab halfway through and stored parts remain without a completed document. Both situations reveal a gap between transferring bytes and completing an application workflow. Multipart upload needs an explicit agreement between the client, the application, and object storage.

For an Amazon S3-backed service, design that agreement before adding a progress bar. Track the upload’s identity, distinguish uploaded parts from an accepted file, reconcile uncertain completion, and clean up abandoned work. The following approach focuses on application behavior rather than promising that every successful network transfer automatically becomes a usable customer document.

Define the application states first

Start with states such as created, transferring, completing, stored, and ready for use, plus canceled and failed outcomes. These are proposed application states; choose names that fit your product. Define what evidence moves the upload between them. “Stored” might mean that S3 has confirmed the completed object, while “ready” may additionally require validation, scanning, or attachment to the correct customer record.

This distinction keeps the interface honest. A browser can finish sending parts while server-side completion or validation remains pending. Show that remaining stage clearly. If the customer navigates away and returns, load the durable application state instead of reconstructing success from a local progress percentage. A useful upload history explains whether the file is still transferring, being checked, accepted, or awaiting a correction.

Create a durable identity before issuing access

Create an application upload record with its owner, tenant, intended destination, expected properties, and a stable operation identifier. Associate the storage upload ID with that record. Generate object keys under application control so a client cannot choose another tenant’s destination. Keep access appropriately scoped and time-limited, and recheck authorization when the application performs completion or attachment.

AWS’s multipart-upload overview describes initiation, part upload, and completion as separate stages. Reflect those stages in your record rather than storing only a final object URL. If initiation succeeds but the application response is lost, reconciliation needs to know whether an upload already exists before creating another independent transfer for the same user action.

Track parts without confusing them with acceptance

Maintain the part information required by the chosen SDK and completion protocol, including part numbers and returned identifiers. Treat retries of a part as part of the same upload session. Validate the intended complete file against the application’s constraints, rather than assuming that a collection of individually accepted parts proves the customer’s file meets every requirement.

Decide what happens when the customer selects a different local file during recovery. File name alone is not a reliable identity. The resumed transfer must correspond to the original upload’s content and properties under your chosen verification method. If the client cannot establish that relationship, explain why a new upload is required and arrange cleanup for the abandoned one instead of combining unrelated parts into an ambiguous result.

Interpret completion through the actual API result

S3’s CompleteMultipartUpload reference requires the appropriate ordered part information. It also documents an important response detail: an error can be embedded after an initial HTTP 200 response. AWS SDKs handle that condition through their response and error processing. A custom caller must interpret the complete response rather than treating the status line alone as final success.

Record the verified outcome and the object identity returned or established by the completion process. Do not mark the application record ready solely because the browser called a “finish” endpoint. That endpoint needs to perform or verify the relevant transition, enforce ownership, and return an outcome consistent with durable state. If additional processing remains, expose that state separately from storage completion.

Reconcile uncertain results before starting over

A connection can fail after storage completes an object but before the application records success. Design a recovery path that checks the intended object and operation identity under the storage system’s documented behavior. Use an application-controlled key or version reference that makes the result attributable to the correct upload. Existence at a reused key alone may be insufficient evidence that this particular operation succeeded.

When the outcome remains uncertain, retain the record in a reconciling state with a bounded retry and escalation policy. Avoid immediately initiating a second upload and attaching whichever result appears first. That can create duplicates or connect an older object to the customer’s current request. Test the failure boundary by deliberately interrupting the application after storage confirmation and before the database update.

Separate cancellation from completed-object removal

Canceling an unfinished transfer and deleting an already completed object are different operations. AWS’s abort guidance explains cleanup of incomplete multipart uploads. Coordinate cancellation with in-flight part requests, then verify the cleanup outcome according to the storage API. A browser tab closing is not by itself a reliable server-side cancellation instruction.

Handle the race between cancel and complete explicitly. If completion wins, the application must decide whether the resulting object should be retained, detached, quarantined, or removed under its normal policy. Do not display “canceled and deleted” without confirming the relevant outcome. Keep the customer-facing record traceable while reconciliation runs so support can explain what happened without manually guessing from object names.

Add lifecycle cleanup as a backstop

Incomplete parts can remain stored until the upload is completed or aborted. Configure cleanup deliberately rather than assuming abandoned browser sessions disappear automatically. S3 provides an AbortIncompleteMultipartUpload lifecycle action based on days since initiation. Scope and review the rule against the service’s legitimate upload durations and recovery policy.

Treat lifecycle cleanup as a backstop for abandoned work, not as the application’s only cancellation mechanism. It does not replace your upload record or decide whether a completed document is authorized. Align the interface with the cleanup horizon: an old transfer should not continue promising resumability after its storage session is eligible for removal. Offer a clear restart path while preserving useful diagnostic history.

Test the handoffs and monitor unfinished work

Exercise failures after initiation, during a part retry, during completion, after storage success, and during cancellation. Include expired client access, revoked tenant permission, and a tab reopened on another device. For each test, inspect the upload record, storage result, and customer-visible state. The system passes when those outcomes converge without duplicate attachments or unexplained orphaned transfers.

Monitor age and count of uploads in transferring and reconciling states, completion failures, and cleanup outcomes. Keep those measures separate from accepted-file totals. AI can assist with grouping sanitized error patterns or drafting support explanations from verified state, but it should not infer that a file exists or authorize cleanup. Any automated repair should follow explicit state transitions and leave an auditable record of what it verified.

Conclusion

Multipart upload becomes reliable when every handoff has a durable identity and a verified outcome. Track the transfer before issuing access, distinguish parts from accepted files, reconcile uncertain completion, and coordinate cancellation with cleanup. These decisions let the product explain progress honestly and recover from interrupted uploads without turning storage leftovers into customer confusion.

LET’S BUILD SOMETHING USEFUL

Turn what you’ve learned into your next project.

Talk to Ataraxy Developers about your website, app, or custom software.

Ataraxy Developers — Turning Digital Visions Into Reality

Ataraxy Developers builds websites, mobile apps and custom software for businesses in the US, Pakistan and beyond.

Join Our Newsletter

Get insights on software, digital products and automation from our development team.

You have been successfully Subscribed! Ops! Something went wrong, please try again.