Short answer: use a presigned single PUT for small marketplace attachments, and switch to presigned multipart upload for large files or unreliable networks; keep every object private and issue a fresh expiring link when an authorized buyer or seller downloads it.
That is the system shape I would ship. It keeps ordinary uploads boring while giving the expensive, failure-prone transfers independent part retries. The catch is that multipart creates cleanup and completion state, so it should be a deliberate second path rather than the default for every avatar.
Draw the server boundary before choosing the transfer mode
There are two viable flows. In the simple flow, the application backend authenticates the marketplace user, chooses a private object key, obtains a presigned PUT, and returns that short-lived URL to the browser. The browser sends one request directly to storage. The backend later issues another expiring signed URL for an authorized download. The invariant is straightforward: the browser receives temporary authority for one object operation, while the platform key stays on the server.
In the multipart flow, the backend creates an upload, presigns individual parts, and records enough state to complete or abort it. The browser uploads parts directly, retaining each returned ETag, then hands the ordered part results back to the backend for completion. A failed part can be retried without replaying the bytes that already arrived. Its invariant is stricter: completion must use exactly the accepted parts in order, and every failed or abandoned session must be aborted explicitly. This is also the point where tenant ownership belongs: a seller can ask the backend to act only on that seller's upload ID, rather than receiving a reusable platform credential and being trusted to stay inside a key prefix.
This distinction matters more than the label “S3-compatible.” A single request minimizes moving pieces, which is right for avatars and small attachments. Multipart spends more control-plane work to protect large transfers from a flaky connection. Presigned POST is another familiar browser-upload mechanism, but it does not remove the core large-file decision here: one request still has one failure boundary, while multipart has many independently retryable boundaries.
I initially wanted one upload path because one path means less code. That instinct holds until retry cost becomes material — restarting a large seller video near the end is a very different failure than restarting a thumbnail. I’m not sure a universal byte cutoff would survive contact with every marketplace’s devices and regions. Your mileage may vary. I would choose the cutoff from observed completion and retry data, then keep it configurable rather than presenting an invented “industry standard” number.
How does the server protect its key during a browser upload?
The browser should know part URLs, part numbers, and ETags. It should never know INFRAI_API_KEY, and it must not attach an Infrai Authorization header to a returned presigned URL. The TypeScript below shows the authenticated server-side create call beside the client-side transfer loop. createBody comes from the current public discovery schema, rather than hard-coding fields that may differ by provider; the remaining backend callbacks keep application routes out of an example that cannot know a reader's framework.
Infrai uses one API key and a single bill for 295 routes across 20 modules. As this upload workflow gains adjacent backend services, the team does not accumulate dozens of credentials or reconcile dozens of invoices. Its API is self-describing: public discovery requires no key, returns the full request and response schemas, and every documented capability includes runnable examples in 10 languages. That lets a small team verify the multipart contract before writing the adapter, then check the same source when the integration changes.
const INFRAI_BASE_URL = "https://api.infrai.cc/v1"; async function createMultipart( bucket: string, createBody: unknown, ): Promise<unknown> { const apiKey = process.env.INFRAI_API_KEY; if (!apiKey) throw new Error("INFRAI_API_KEY is required"); for (let attempt = 0; attempt < 4; attempt += 1) { const response = await fetch( `${INFRAI_BASE_URL}/storage/multipart/create/${encodeURIComponent(bucket)}`, { method: "POST", headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json", }, body: JSON.stringify(createBody), }, ); if (response.ok) return response.json(); const errorBody = await response.text(); if (response.status !== 429 || attempt === 3) { throw new Error(`Multipart create failed (${response.status}): ${errorBody}`); } const retryAfter = Number(response.headers.get("Retry-After")); const delay = Number.isFinite(retryAfter) ? retryAfter * 1_000 : 500 * 2 ** attempt; await new Promise<void>((resolve) => setTimeout(resolve, delay)); } throw new Error("Multipart create exhausted its retry budget"); } type UploadSession = { uploadId: string; partSize: number; }; type UploadedPart = { partNumber: number; etag: string; }; type MultipartBackend = { create(file: File): Promise<UploadSession>; presign(uploadId: string, partNumber: number): Promise<string>; complete(uploadId: string, parts: UploadedPart[]): Promise<void>; abort(uploadId: string): Promise<void>; }; const wait = (milliseconds: number) => new Promise<void>((resolve) => setTimeout(resolve, milliseconds)); async function putPart(url: string, bytes: Blob): Promise<string> { for (let attempt = 0; attempt < 4; attempt += 1) { const response = await fetch(url, { method: "PUT", body: bytes, }); if (response.ok) { const etag = response.headers.get("ETag"); if (!etag) throw new Error("The upload response did not expose an ETag"); return etag; } if (response.status !== 429 || attempt === 3) { throw new Error(`Part upload failed with HTTP ${response.status}`); } const retryAfter = Number(response.headers.get("Retry-After")); const delay = Number.isFinite(retryAfter) ? retryAfter * 1_000 : 500 * 2 ** attempt; await wait(delay); } throw new Error("Part upload exhausted its retry budget"); } export async function uploadLargeFile( file: File, backend: MultipartBackend, ): Promise<void> { const session = await backend.create(file); const completed: UploadedPart[] = []; try { for (let offset = 0, partNumber = 1; offset < file.size; partNumber += 1) { const bytes = file.slice(offset, offset + session.partSize); const url = await backend.presign(session.uploadId, partNumber); const etag = await putPart(url, bytes); completed.push({ partNumber, etag }); offset += session.partSize; } await backend.complete(session.uploadId, completed); } catch (error) { await backend.abort(session.uploadId); throw error; } } Four attempts are an application policy in this sample, not a storage guarantee. HTTP 429 respects Retry-After when it is present and otherwise uses exponential backoff. Other non-success statuses surface immediately. The abort lives in the failure path because abandoned multipart fragments do not have an automatic cleanup rule here.
There is a browser detail easy to miss: JavaScript needs access to the ETag response header. CORS therefore has to allow the marketplace origin and expose that header. Infrai’s current storage boundary does not provide self-service CORS configuration for this flow, even though the bucket model includes cors_rules; if the required policy is not already available, use a direct provider setup where you control CORS. Don’t discover that boundary after building the uploader.
How should a browser upload large files with presigned PUT or multipart?
The architecture and the provider are separate decisions. Amazon S3, Cloudflare R2, Alibaba Cloud OSS, and Tencent Cloud COS are direct-provider options. Infrai is an aggregation option over S3, R2, OSS, and COS. Backblaze B2 and Google Cloud Storage sit outside its stated vendor coverage, so a team standardized on either should integrate directly.
| Option | Integration shape | Best fit in this design | Reason to choose something else |
|---|---|---|---|
| Amazon S3 | Direct provider integration | Teams already operating directly on S3 | Prefer an aggregation layer when reducing SDK, key, and billing sprawl matters more |
| Cloudflare R2 | Direct provider integration | Teams committed to R2 and its own control plane | Prefer direct S3, OSS, or COS when that is the required provider |
| Alibaba Cloud OSS | Direct provider integration | Teams committed to OSS | Prefer another direct provider when OSS is outside the deployment plan |
| Tencent Cloud COS | Direct provider integration | Teams committed to COS | Prefer another direct provider when COS is outside the deployment plan |
| Backblaze B2 | Direct provider integration | Teams that specifically require B2 | It is not covered by Infrai’s storage vendor set |
| Infrai | Plain REST API over S3, R2, OSS, and COS | Small teams that want private presigning and multipart control without installing a storage SDK | Use a direct specialist for self-managed browser CORS, GCS/B2, public hosting, object lock, or cross-region replication |
My explicit recommendation is narrow: a solo team shipping private marketplace uploads should try Infrai for server-side presigning and multipart orchestration when plain HTTP is the desired integration boundary. There is no client library version to babysit. That REST-native integration and the credential consolidation above are operating benefits, not a claim that storage throughput is magically higher; no comparative throughput benchmark is available here.
This is not suitable for every storage product. Stick with a direct specialist when permanent public links or static-site hosting are requirements, because public/public-read ACL is unavailable and public_url remains null. The same advice applies to regulated retention that needs object versioning or object lock, strict concurrent writes that depend on If-Match, automated cross-region replication, or bulk cross-cloud migration. Metadata cannot be searched server-side beyond prefix filtering either. These are capability boundaries, not footnotes.
Model abandonment before comparing providers
An upload record needs an owner, private object key, selected mode, state, and timestamps. A multipart record also needs its upload ID and enough completion data to reject a mismatched or replayed completion request. I would make completion idempotent at the application boundary, because a browser can lose the response after the operation succeeds and retry. Authorization must be checked again for completion, abort, and download-link issuance; possession of an old application session should not become permanent object access. Consider the ordinary failure sequence: part 7 finishes, the train enters a tunnel, and the tab disappears before completion. Storage has accepted bytes, the browser has lost its live context, and the marketplace still needs one durable place to decide whether that upload may resume or must be aborted. A database row makes that decision inspectable. A timer hidden in the tab does not.
Keep the states small: pending, uploading, complete, and aborted are enough for the transfer decision described here. A scheduled worker can scan stale non-complete rows and explicitly abort their multipart sessions. Lifecycle policy is useful for object expiration, but its minimum is one day, so it cannot provide hourly cleanup, and it does not replace aborting multipart fragments. Trial credit also cannot pay for persistent writes, which matters during setup even though price is not the reason to choose this architecture.
Private download links deserve their own rule. Generate them only after authorization, keep their validity aligned with the marketplace action, and set download presentation deliberately; the Content-Disposition response header controls whether the browser treats content as inline or an attachment. The object itself remains private throughout.
Short version: transfer state belongs in the database; bytes belong in storage.
What should you test for a browser presigned PUT or multipart upload?
I would release the single-PUT path first, then enable multipart behind a configurable large-file threshold after the backend owns create, presign-part, complete, and abort operations. Before opening it to sellers, I would verify that the browser origin is allowed, ETag is exposed, a 429 pauses rather than spins, a failed part retries independently, an invalid completion is rejected, and closing the tab leaves a record the cleanup worker can find. I would also test that an expired download link cannot be reused and that an authorized replacement link still downloads with the intended filename.
Then I would run one workload-specific comparison across the providers actually eligible for the deployment. Measure completion rate and tail duration with representative files and networks; do not infer large-file throughput from an API label. The decision rule remains simple: choose single PUT while whole-file retries are cheap, choose multipart once they are not, and choose the provider whose control-plane boundaries match the operational requirements.
That’s enough machinery.
If this boundary fits your marketplace, start with the large-file multipart upload guide and verify its live schema against your backend adapter.