The standard
FlexFileUpload picker sends a whole file through Livewire. Chunking is an opt-in integration for an upload interface you control. Your application creates and authorizes each session and decides when to attach the verified file.1. Install session tables explicitly
database/migrations directory. It does not run it. Review the migration, then run your normal application migration process:
fff_upload_sessions and fff_upload_parts. They store transfer state and part metadata; they do not replace your application’s gallery table or Spatie’s media table.
If you choose a separate database connection or table prefix below, edit the published migration to use that same connection and prefix in both up() and down(). The default published migration deliberately uses the default connection and fff_ names.
2. Configure local limits
Merge this section intoconfig/filament-flex-fields.php:
All upload-serving workers must see the same local staging filesystem and database. Independent container-local directories cannot resume one another’s uploads. Your proxy’s request body limit must accommodate a chunk, and request timeouts must accommodate its transfer. The declared total size still needs application-level authorization and quota checks before creating a session.
Example limits for two deployments
For the 8 MiB example behind Nginx, allow a slightly larger request body at the upload route, for example
client_max_body_size 10m;. Check any limits imposed by a reverse proxy or CDN too. The application still enforces its own maximum chunk and total file sizes.
3. Create a server-owned session
This example adds a chunk uploader to an existing post editor. It assumes your application has anApp\Models\Post model and an update policy. The Laravel session associates the upload ID with the post, so the browser does not choose its owner or tenant.
Add a session-creation route in routes/web.php:
create(). For a multi-tenant application, resolve the active tenant on the server, scope the post lookup to that tenant, and use its ID in UploadScope at creation and on every subsequent request. Remove session associations after acceptance or expiry. For high-volume uploads or resume across authenticated devices, keep associations in your application database with an expiration date.
4. Receive chunks through the PHP service
Use this API when your application owns the HTTP controller. Streams are borrowed: the caller closes them after the operation.sha256 followed by the Base64-encoded binary SHA-256 digest of that chunk. SHA-1 is also supported for protocol compatibility. A mismatched offset or checksum does not advance the committed offset. After a lost response, read the current owned session and resume from its reported offset rather than assuming the last request failed:
Optional tus HTTP endpoint
Setresumable.http.enabled to true after binding an application implementation of UploadRequestAuthorizer. Both resumable.enabled and resumable.http.enabled must be true. The endpoint refuses requests without an authorizer.
file_upload.resumable.http.enabled to true once the binding is in place. Keep web, auth and throttling in the route middleware for this recipe. The authorizer runs on every request, including OPTIONS.
Generate the URL through the named route:
For clients that cannot issue
PATCH, POST with X-HTTP-Method-Override: PATCH is supported. This is not the tus Creation extension: applications create the admitted session separately. Concatenation is not implemented.
Keep authentication, CSRF protection and route throttling appropriate to your application. The default web middleware means browser writes need the application’s CSRF token. Changing a route prefix may require rebuilding Laravel’s route cache. Cross-origin access is not enabled automatically.
Relevant response codes include 409 for offset/state conflict, 410 for expired/unavailable sessions, 412 for an unsupported protocol version, 413 for an oversized chunk and 460 for a checksum mismatch. Reconcile an ambiguous transfer with HEAD before sending more bytes.
Send chunks from a same-origin form
Pass the file, the session-creation response and your Laravel CSRF token to this function. It returns only when the server has all the bytes. If the request fails, calling the function again starts withHEAD and resumes from the server’s current offset. Keep the same file for the same session.
Content-Length for the Blob. Preserve it through your proxy. Show an explicit resume action on network failure, and ask the user to start a fresh session after HTTP 410. tus 1.0 protocol
Create the session once for the selected file:
session while the upload is active. The resume action calls sendChunks() again with that session. After it finishes, pass session.id to your application’s attachment action.
5. Inspect and attach a completed local upload
Inspect the fully assembled source with the application’s media policy:complete(); processing belongs to the final persistence step.
To hand it to an existing FLEX field, resolve the current field instance on the server, authorize it again and use the attachment bridge:
S3 Multipart configuration
For direct uploads to object storage, use the dedicated S3 Multipart setup. The two transports can share the same session tables.Expiration and local cleanup
Enable cleanup explicitly after reviewing its retention policy:Resume expectations
- Within one transfer, keep the same
File/Bloband ask the server which bytes or parts are already present. - Across a page reload, the browser may require the user to reselect the source file. File identity and durable client restoration are application responsibilities; matching filename and byte count alone does not prove the same content.
- Server session state survives independently of an open picker, but the default field does not automatically restore a custom chunk uploader after reload.
- A processing worker is a separate stage. Chunking transfers bytes; conversion jobs need their own queue configuration and processing status presentation.
Verify your setup
- Create a session and upload a file larger than one chunk. Confirm that the reported offset advances after each successful request.
- Interrupt the connection mid-transfer. Resume with the same file and confirm that the next request starts at the offset returned by
HEAD. - Send a deliberately wrong checksum and confirm the offset does not advance. Compare the final file against the source before accepting it.
- Try the same session from a different account or after revoking record access. The authorizer should deny it.
- Cancel a temporary upload, then test retention on expired fixtures. Check that active sessions and permanent files are preserved. A verified temporary file can expire while it is still waiting for form acceptance.