Chunked uploads
Large files go straight to storage in chunks instead of travelling base64-encoded inside the create or update request.
Below a configurable threshold nothing changes — a small image is still embedded in the payload. Above it the browser uploads to S3 or a tus server, and the request carries only a reference the backend resolves on save.
Chunked uploads ship in the paid habarico-enterprise gem — see
Installation. Without it every file field keeps using the base64 path and no
options.upload block is emitted at all.
habarico_enterprise/uploads is an opt-in module — it is not loaded by
require "habarico_enterprise" — for Eluvia::File/file_attr-backed fields. Ruby habarico
assumes a single default ActiveStorage service, so provider selection is global rather than per
field; see Provider selection.
Pages
| Page | What it covers |
|---|---|
| Installation | Adding the gem, habarico_enterprise/uploads and its routes |
| Configuration | Threshold, chunk size and provider settings |
| Provider selection | S3 multipart vs. tus, and how the single-storage assumption differs from Python |
| tus server setup | Running and securing a tusd service |
| S3 temporary file cleanup | Removing abandoned uploads |
| Frontend contract | What the browser sends and when, and the content-type / size rules initiate enforces |
How it fits together
- The backend adds
options.uploadto the field schema — provider, threshold, chunk size. - UploadInput reads it and picks the path per file.
- For the S3 provider,
initiaterefuses the upload up front when the claimed content type or size is not allowed for that field — see Upload validations. - A chunked upload finishes with an
upload_key;Eluvia::File#upload_key's finalize step (theeluvia-baseextension point this module registers) turns it into anActiveStorageattachment when the record is saved.
Client-side resize and crop only apply to the base64 path. A file large enough to be chunked is uploaded untouched — see the caution on UploadInput.
See also
- UploadInput — the frontend side
- useUploadQueue — the queue behind it
- Chunked uploads — the Python counterpart
- REST API reference — the
upload-initiate/upload-complete/upload-abortendpoints - File uploads — the path through these pages