Short answer: use a presigned single-object PUT for ordinary receipt images and PDFs, switch to multipart when a file crosses a deliberately tested retry-cost threshold, and reserve presigned POST for cases where form-level constraints are more important than resumability. The deciding constraint is not raw size alone. It is whether an interrupted browser session can be retried without weakening tenant authorization, losing the original evidence, or creating an ambiguous audit record.

For a healthtech receipt workflow, upload success and receipt acceptance must be separate events. A browser may finish moving bytes while the application still lacks the tenant binding, content digest, retention decision, and processing state needed to treat the object as evidence. Keeping that distinction explicit produces a less convenient API, but it prevents a transport acknowledgment from quietly becoming a ledger entry.

This is the architecture decision: expose two transfer paths behind one application-owned upload session, then finalize both through the same validation and audit transaction. Don't let the browser choose an object key, don't overwrite an accepted original, and don't enqueue extraction until finalization has verified the server-issued session. Exactly once is an application invariant here, not a claim about the network.

Security invariants for retained clinical evidence

The original receipt is immutable after acceptance. Derivatives such as normalized images, OCR text, and redacted previews belong under different identifiers; replacing the original would erase the byte sequence on which an earlier decision was based. The application database records who initiated the upload, which tenant owns it, the expected size and media type, the opaque storage key, the selected transfer mode, expiration, and a monotonic state such as created, uploading, uploaded, accepted, or rejected.

Authorization ends at a narrow capability. The application authenticates the user before creating an upload session, derives the tenant from that authenticated context rather than request data, and signs only the opaque key allocated to that session. A download is a separate authorization decision. Even if the storage system can return an object directly, the application should decide whether the caller may receive it and whether the response is inline or an attachment; Content-Disposition controls that presentation behavior, but it is not an access-control mechanism.

Keep those layers apart.

No exceptions.

The most dangerous boundary is finalization. Browser callbacks are evidence that a client believes the transfer ended, not proof that the expected object should enter the processing pipeline. Finalization must be idempotent because tabs retry, mobile connections switch networks, and clients can submit the same request twice. Consider the unremarkable race that exposes the problem: one tab finishes transferring receipt R-1842, its finalize response is lost, the user presses retry, and a second request arrives while the first database transaction is committing. If receipt identity is allocated after transfer, those two calls can create two business records for one original; if finalization blindly overwrites storage metadata, the later call can also erase the evidence needed to explain which digest was accepted. Allocate the receipt and opaque object key first, bind both calls to one idempotency record, lock that record during acceptance, and return its prior outcome after commit. Under an exactly-once mindset, duplicate finalize calls then converge on the already recorded result, while a different digest or size for the same idempotency key is a conflict that requires investigation rather than an overwrite. The audit trail should answer the corresponding hard questions without consulting transient logs: which principal requested the capability, which tenant and receipt the server bound to it, when the capability expired, which transfer mode was selected, which object version or immutable key was accepted, and which idempotency key caused the state transition. This does not make the system compliant by declaration — legal retention periods, permitted access, deletion duties, and evidence requirements still depend on the applicable jurisdiction and organizational policy — but it gives those policies an enforceable technical boundary.

How should a browser choose presigned POST, PUT, or multipart for large files?

Choose with a policy owned by the server, not a branch improvised in browser code. The threshold should come from tests that reflect the actual receipt distribution, client networks, storage implementation, and operational cost model. I'm not sure there is a defensible universal cutoff: a 20 MB pathology attachment on an unstable connection may deserve multipart, while a larger upload on a managed workstation may complete reliably as one PUT. Your mileage may vary, so record the selected mode and compare completion, abandonment, and retry behavior before changing the policy.

Transfer Prefer it when Failure and control boundary Avoid it when
Presigned PUT One object can be retried as a unit and the application already controls the exact key A retry resends the object; authorization remains bound to one server-selected destination Repeating the entire transfer would be operationally unacceptable
Presigned POST Browser form submission and server-defined form constraints are the central requirement The signed form is the capability; acceptance still requires application finalization The workflow needs independent part retries or pause-and-resume behavior
Multipart A large transfer benefits materially from retrying bounded parts Parts are provisional until completion; abandoned sessions require lifecycle cleanup The extra session state, completion step, and cleanup burden exceed the measured retry benefit

PUT is the boring default, which is a virtue. It minimizes state: create the application session, issue a time-limited upload capability, transfer one object, then finalize. The catch is that a late failure repeats all bytes, so it isn't suitable when that retry unit violates the team's tested failure budget.

Multipart reduces that retry unit, but it moves complexity into places that matter for correctness. The application has to bind the multipart upload identifier to the same tenant-owned session, constrain part numbering and completion to that session, reject completion after expiration, and reconcile storage state with database state. Parts that arrive out of order are normal; a second logical receipt created from the same client retry is not. Cleanup also becomes a first-class operation because an abandoned multipart session is neither an accepted receipt nor harmless application state.

POST is valid when a form-based browser workflow and signed constraints are the dominant concern. Stick with POST when those constraints make the client simpler and files remain inside the tested single-transfer envelope. It is not a substitute for multipart merely because both begin with a presigned capability.

Implement the acceptance protocol in Go

The useful abstraction is not a vendor client. It is an application service that allocates identity before bytes move, asks an interchangeable signer for a constrained capability, and accepts exactly one immutable result afterward. The following Go sketch omits provider-specific signing fields on purpose; the signer implementation supplies them, while the service preserves the invariants that survive a storage migration.

package receipts import ( "context" "errors" "fmt" "time" ) type Mode string const ( ModePut Mode = "put" ModePost Mode = "post" ModeMultipart Mode = "multipart" ) type UploadRequest struct { TenantID string ActorID string ReceiptID string MediaType string SizeBytes int64 Idempotency string } type Session struct { ID string TenantID string ObjectKey string Mode Mode ExpiresAt time.Time Accepted bool Digest string SizeBytes int64 } type Capability struct { Method string URL string Fields map[string]string } type Repository interface { CreateOrGet(context.Context, UploadRequest, Mode, time.Time) (Session, error) GetForUpdate(context.Context, string, string) (Session, error) Accept(context.Context, Session, string, int64) error } type Signer interface { SignPut(context.Context, Session, string) (Capability, error) SignPost(context.Context, Session, string, int64) (Capability, error) BeginMultipart(context.Context, Session, string) (Capability, error) } type Objects interface { Stat(context.Context, string) (size int64, digest string, err error) } type Service struct { Repo Repository Signer Signer Objects Objects MultipartAtBytes int64 // A tested policy value, not a universal constant. CapabilityTTL time.Duration } func (s Service) Begin(ctx context.Context, req UploadRequest) (Session, Capability, error) { if req.TenantID == "" || req.ActorID == "" || req.Idempotency == "" { return Session{}, Capability{}, errors.New("authenticated tenant, actor, and idempotency key are required") } mode := ModePut if req.SizeBytes >= s.MultipartAtBytes { mode = ModeMultipart } session, err := s.Repo.CreateOrGet(ctx, req, mode, time.Now().Add(s.CapabilityTTL)) if err != nil { return Session{}, Capability{}, fmt.Errorf("create upload session: %w", err) } var capability Capability switch session.Mode { case ModePut: capability, err = s.Signer.SignPut(ctx, session, req.MediaType) case ModePost: capability, err = s.Signer.SignPost(ctx, session, req.MediaType, req.SizeBytes) case ModeMultipart: capability, err = s.Signer.BeginMultipart(ctx, session, req.MediaType) default: err = fmt.Errorf("unsupported transfer mode %q", session.Mode) } return session, capability, err } func (s Service) Finalize(ctx context.Context, tenantID, sessionID string) error { session, err := s.Repo.GetForUpdate(ctx, tenantID, sessionID) if err != nil { return fmt.Errorf("load upload session: %w", err) } if session.Accepted { return nil } if time.Now().After(session.ExpiresAt) { return errors.New("upload session expired") } size, digest, err := s.Objects.Stat(ctx, session.ObjectKey) if err != nil { return fmt.Errorf("inspect uploaded object: %w", err) } if size != session.SizeBytes { return fmt.Errorf("size mismatch: expected %d bytes, received %d", session.SizeBytes, size) } return s.Repo.Accept(ctx, session, digest, size) } 

There are two intentional pressure points in this design. First, TenantID appears on the repository lookup during finalization, preventing a valid session identifier from becoming cross-tenant authority. Second, CreateOrGet is keyed by the application idempotency value, so a repeated begin request yields the same logical session instead of allocating another receipt. The database operation behind Accept should make the state transition and outbox record atomic; a worker can then process the outbox and produce derivatives without asking the browser to coordinate storage with the job system.

Reliability requires failure injection before deployment

Do not log the capability URL or signed form fields. They are temporary credentials. Log stable identifiers, selected mode, part counts where applicable, elapsed time, accepted size, and state transitions, then reconcile sessions that remain provisional beyond their allowed lifetime. A useful deployment test interrupts each mode before and after byte transfer, repeats both begin and finalize calls, attempts a tenant swap, expires a capability, and verifies that no path creates two accepted originals.

Measure it.

Cost belongs in this test, but it should not lead the decision. Storage schedules can price capacity, requests, retrieval, and transfer differently; Backblaze B2's public pricing page is one concrete example of why a model must include more than stored bytes. Use the schedule for the implementation being evaluated, apply the team's measured request and retry counts, and keep those assumptions beside the architecture record rather than hard-coding a supposedly universal winner.

The operational comparison also has to include the rejected design, because moving bytes through the application changes both the control surface and the cost surface.

Cost boundaries and the rejected upload proxy

The rejected design is a single public browser upload path that chooses arbitrary object keys and treats transfer completion as receipt acceptance. It looks simpler because it removes the application session, but it also collapses authorization, storage identity, and business acceptance into one event. That makes replay analysis and tenant reconciliation needlessly uncertain.

Public writes are not suitable for private healthtech receipts. A server-mediated byte stream is the valid alternative when organizational policy requires every byte to pass through application-controlled inspection before storage, when the target storage cannot express the necessary constrained capability, or when browser access to the storage origin is prohibited. Its limitation is equally concrete: the application now owns the data-plane bandwidth, backpressure, and retry behavior. Stick with that path when centralized control is worth the delivery burden; otherwise, direct upload with an application-owned control plane keeps access decisions on the server without turning the server into a file relay.

The final rule is deliberately plain: start with presigned PUT, earn multipart with evidence about retry cost, and use POST for form constraints rather than as a vague middle ground. Whichever transfer moves the bytes, accept the receipt only through the same tenant-scoped, idempotent, auditable finalization boundary.

References