Small image upload to object storage is usually a delivery problem before it is a multipart problem: for beginner avatar files, one authenticated upload is easier to reason about, while larger receipt objects may justify resumable parts to protect audit delivery on unreliable connections.

Short answer: use a single upload request for small avatar files, define the size threshold as application policy, and keep multipart upload for transfers where restarting the whole object is expensive. In an e-commerce system, treat the original receipt as a separate audit object with stricter access control, even when the avatar path is optimized for fast delivery.

The threshold is not a universal storage constant. Measure file sizes, client reliability, retries, and the cost of repeating a request before choosing it.

The retry budget behind a small image upload

Multipart upload splits an object into independently transferred parts. That can reduce the amount of data lost when a large transfer fails, but it also introduces an upload identifier, part state, completion logic, and abandoned-upload cleanup. For a small avatar, the extra state can be harder to test than the original request is to retry.

This is a delivery decision, not a claim that multipart is bad.

For a beginner implementation, keep the policy explicit:

  • Reject files above the product limit before either upload flow starts.
  • Send small avatar files in one request when repeating the bytes is acceptable.
  • Use multipart for larger objects when resumability or unreliable connections justify the state.
  • Record the object key, byte count, content type, checksum decision, and final status.

The storage adapter should hide provider-specific request details, but it should not hide the business transition. An upload being present is not the same as an avatar being attached to a profile or a receipt being accepted as audit evidence.

How should a beginner choose object storage and a multipart upload threshold?

Start with authorization. The application should create an object key, validate the user and declared metadata, and grant permission for that one operation for a limited period. A presigned URL is one established pattern for time-limited access to a specific storage operation; its expiration belongs in the security design, not in a UI convenience setting. The storage service still needs its own policy checks, and the application should verify the resulting object before attaching its key to a record.

Here is a deliberately generic policy function. The numbers are examples of product limits, not recommended storage defaults; they must be replaced or removed after measuring the actual traffic.

type UploadPlan = | { mode: 'single'; maxBytes: number } | { mode: 'multipart'; maxBytes: number; partBytes: number }; const AVATAR_LIMIT_BYTES = 5 * 1024 * 1024; const MULTIPART_THRESHOLD_BYTES = 2 * 1024 * 1024; export function planAvatarUpload(sizeBytes: number): UploadPlan { if (!Number.isInteger(sizeBytes) || sizeBytes <= 0) { throw new Error('invalid file size'); } if (sizeBytes > AVATAR_LIMIT_BYTES) { throw new Error('avatar exceeds the application limit'); } return sizeBytes < MULTIPART_THRESHOLD_BYTES ? { mode: 'single', maxBytes: AVATAR_LIMIT_BYTES } : { mode: 'multipart', maxBytes: AVATAR_LIMIT_BYTES, partBytes: 2 * 1024 * 1024, }; } 

There is a trap here. If the avatar limit is lower than the multipart threshold, the multipart branch can never run; if the threshold is too low, a beginner has paid the coordination cost for files that are cheap to retry. A better test suite exercises the boundary, a zero-byte input, a non-integer size, an over-limit file, and an object uploaded successfully but never attached. I’m not sure which threshold fits a given audience without those measurements, and your mileage may vary on mobile networks.

What breaks when delivery simplicity outranks access control?

The first failure mode is an orphaned object. A user selects a file, the upload succeeds, and the profile update fails. Without reconciliation, storage keeps bytes that no business record owns. Give each upload a state such as created, uploading, uploaded, attached, or rejected; make attachment repeatable; and make cleanup safe to run more than once.

The second is an authorization gap. A public avatar URL may be acceptable for a particular product, but a receipt original can contain names, addresses, totals, and other order evidence. Keep the original in a restricted location, derive a display image only when the product permits it, and issue access for the narrow operation that needs it. Do not put signed URLs or receipt contents in ordinary application logs.

The third is treating the browser's success callback as proof of business completion. The server still needs to inspect the expected object, compare the recorded metadata with policy, and then attach it to the right user or order. For multipart, add tests for a missing part, a repeated part, a failed completion, and an upload abandoned halfway through.

Short. Clear. Testable.

When should an avatar path differ from a receipt audit path?

An avatar is user-facing and replaceable. A receipt original is an audit artifact with a different retention and access decision, so the two flows can share an adapter while keeping separate lifecycle rules. The order record should point to the original object deliberately, and any thumbnail or preview should have its own ownership and deletion behavior.

GDPR Article 17 is a useful prompt for deletion design: removing an account may require handling the object, database references, thumbnails, caches, and logs that retain personal data, subject to applicable legal conditions and exceptions. Record deletion outcomes so an operator can distinguish completed erasure from a pending storage operation.

The catch is that direct-to-storage delivery is not suitable when every byte must be inspected synchronously by a trusted service before acceptance. Route that case through a validation or scanning boundary and accept the extra latency. Stick with a single request for a small file when the business can safely retry it; choose multipart when large transfers, unreliable connections, or resumability earn the added state and cleanup work.

What should be measured before shipping the upload policy?

Measure the distribution of avatar and receipt file sizes, upload duration by client type, retry rate, abandonment rate, time from upload to attachment, and unowned objects found by reconciliation. Also measure how often users replace avatars and how often staff retrieve original receipts. Those observations connect the threshold to product behavior instead of folklore.

Watch for policy drift. Front-end limits, API limits, and storage conditions should agree, and changing one should trigger tests for the others. Keep the threshold configurable, but version the decision in logs so a later investigation can tell which rule handled an upload.

For a beginner building avatar upload, the default should be the smallest state machine that meets the access requirement: one request, a narrow authorization grant, an application-owned key, an explicit attach step, and cleanup for anything left behind. Multipart is valuable when a measured retry cost makes its coordination state worthwhile.

References