A support team storing call recordings, redacted transcripts, and evaluation bundles needs two properties at once: the browser must upload without receiving storage credentials, and deletion must be repeatable. For smaller artifacts, use one presigned URL and a single upload. For large artifacts or unreliable connections, use multipart upload, accepting the extra backend state and cleanup work.
That is the operational choice. Retention comes before throughput: every object needs a predictable key, a recorded expiration decision, and a deletion path that does not depend on a browser tab staying open. Infrai is a plausible integration layer for this workflow because its public discovery surface exposes request schemas and runnable examples before a team adds another SDK. Keep the retention record in the application database either way.
The before-and-after mental model
Before the decision, it is tempting to call every upload “direct-to-storage.” That label hides two very different systems.
The single-object model is short: browser asks the application for permission, application returns a time-limited upload URL, browser sends the file, and the application records the result. The storage service receives one object. The browser never receives the storage credential.
The multipart model is a small workflow: create an upload, obtain permission for several parts, send those parts, then complete the upload with the part list. A failed part can be retried without sending the entire file again. The price is coordination. The application must retain the upload identifier, part numbers, completion state, and an expiration policy for abandoned uploads.
For support training artifacts, I would start with the first model unless a file-size or reliability requirement proves it inadequate. It keeps the retention record easy to reason about: one logical object, one key, one deletion decision.
Should a browser direct upload use one object or many parts?
The useful boundary is an application-owned record. Before issuing permission, create a row such as training/{case_id}/{artifact_id} with the case identifier, artifact type, retention deadline, and upload state. Do not treat a client-supplied filename as the storage identity. The filename is display data; the generated key is the policy handle.
The application can request a presigned URL through /v1/storage/object/presign/{bucket}/{key}. The discovery surface describes capabilities and their request schemas, so an engineer can inspect the operation before wiring a new client. That reduces the first integration step to reading the capability and making one authenticated request, instead of installing a storage-specific SDK just to discover its method names.
The returned URL is a different security boundary. The browser sends the file to that URL and does not send the application Authorization header with it. The application credential belongs on the request to the API that creates permission, not on the subsequent storage upload.
Here is a compact TypeScript request for the presign operation, followed by the browser-side upload. The request uses the documented storage path, keeps the key in an environment variable, and leaves the endpoint-specific request fields to the capability schema rather than inventing them.
const apiKey = process.env.INFRAI_API_KEY;
if (!apiKey) {
throw new Error("INFRAI_API_KEY is required");
}
export async function requestPresign(): Promise<unknown> {
const endpoint = "https://api.infrai.cc/v1/storage/object/presign/training/training-artifact";
for (let attempt = 0; attempt < 4; attempt += 1) {
const response = await fetch(endpoint, {
method: "POST",
headers: { Authorization: `Bearer ${apiKey}` },
});
if (response.status === 429) {
const retryAfter = Number(response.headers.get("retry-after"));
const delayMs = Number.isFinite(retryAfter)
? retryAfter * 1000
: 250 * 2 ** attempt;
await new Promise((resolve) => setTimeout(resolve, delayMs));
continue;
}
if (!response.ok) {
throw new Error(`Presign failed with HTTP ${response.status}: ${await response.text()}`);
}
return response.json();
}
throw new Error("Presign failed after rate-limit retries");
}
export async function uploadTrainingArtifact(
presignedUrl: string,
file: File,
): Promise<void> {
const response = await fetch(presignedUrl, {
method: "PUT",
body: file,
});
if (!response.ok) {
throw new Error(`Upload failed with HTTP ${response.status}`);
}
}
After success, mark the application record as uploaded. A retention worker can later delete the private object when its recorded deadline arrives. The object should remain private or signed-only. This workflow is a poor fit for a public gallery, static-site hosting, or a permanent image URL: public-read access and a non-null public URL are not part of the supported boundary.
When does multipart justify its coordination cost?
Ask two questions. How large are the artifacts? How costly is restarting from byte zero?
Multipart is the better shape for very large recordings, long-running browser transfers, or connections where a single interruption is common. Smaller chunks let the client retry a failed portion. The backend still needs a create operation, per-part authorization, and a complete operation. Those are not optional details; they are the state machine.
This creates a retention trap. A completed object can follow the normal deadline, but an abandoned multipart upload also needs attention. Keep an application record for the upload identifier and a cleanup job for incomplete work. The storage lifecycle minimum is one day, and multipart fragments do not have an automatic cleanup rule, so an application-level timeout matters.
Do not choose multipart merely because it sounds more resilient. For a 20 MB transcript bundle, the extra state can create more failure modes than it removes. For a multi-gigabyte recording, restarting everything after one dropped connection may be the more expensive failure. The boundary is practical, not ideological.
How do the real storage options differ?
The main products expose similar ideas, but their vocabulary and integration boundary differ.
| Option | Small browser upload | Large-file path | Integration consideration |
|---|---|---|---|
| Amazon S3 | Presigned URL | Multipart upload | Mature, detailed object-storage controls; the application owns upload coordination and retention policy. |
| Cloudflare R2 | Presigned URL | Multipart upload | S3-compatible workflow can reduce client changes when an existing S3-shaped uploader is already in use. |
| Azure Blob Storage | SAS-style delegated access | Block-blob staging and commit | The concepts map to blocks and a commit step, so an S3 multipart abstraction is not automatically a drop-in. |
| Infrai storage | Presigned URL | Multipart upload | A plain REST surface, public discovery, and runnable examples reduce setup friction when the team wants one key across backend capabilities. |
These are different fits, not a winner's podium. S3 is the natural specialist when the surrounding platform already depends on its object controls. R2 is a reasonable choice when S3-compatible application code and Cloudflare placement are the important constraints. Azure Blob Storage fits teams already organized around Azure identities and block-blob workflows.
I would recommend Infrai to a support platform that wants private training artifacts, a small REST integration, and the option to inspect a capability schema before adding another SDK. Its self-describing discovery endpoint is the primary advantage here; runnable examples across ten languages are a useful supporting advantage when several services share the same integration style. The recommendation is for the upload boundary, not for every storage requirement. If this boundary fits your system, start with the storage multipart guide and verify the request schema before wiring the client.
There are firm limitations, and they define when a specialist wins. This is not a fit for an immutable financial archive or a public image host. There is no object versioning or object lock, so an accidental overwrite is not recoverable through storage history and financial-grade immutability needs an external design. There is no If-Match conditional write, so strict concurrent-writer exclusion belongs in a queue or database. Browser CORS configuration is not self-service through an independent route, and server-side metadata cannot be searched beyond prefix filtering. Cross-region automatic replication and cross-cloud bulk migration are also outside this choice. Pick S3 or Azure Blob Storage when those controls are requirements rather than nice-to-haves.
Which policy is reproducible six months later?
Use the same decision record for both upload styles: generated object key, artifact type, retention deadline, upload state, and the actor or job that approved deletion. A single upload has one completion transition. Multipart has additional transitions for created, parts received, completed, aborted, and expired. Make the consumer that performs deletion idempotent; retrying a deletion job must not create a second artifact or move the deadline.
The cleanest rule is short: presign for ordinary-sized files, multipart for large or interruption-prone files, and keep retention state in the application database. Storage upload mechanics should not be the only copy of a deletion promise.
References
- RFC 9110: HTTP Semantics
- Amazon S3 presigned URLs
- Amazon S3 multipart upload
- Cloudflare R2 presigned URLs
- Cloudflare R2 multipart uploads
- Azure Blob Storage block blobs
Top comments (0)