Configure a private S3 disk
Install Laravel’s S3 filesystem adapter if your application does not already have it:config/filesystems.php:
Store documents with File Upload
maxSize() uses KiB. This field accepts one PDF up to 25 MiB and saves its storage path through the normal form workflow. Store the path in a nullable string column. A multiple field can use a JSON column with an array cast, or a separate relation using the gallery recipe.
FLEX generates temporary links for private previews and downloads. Keep durable model state as the object path. For a private viewer outside Filament, authorize access to the record first, then generate a fresh URL:
Queue image conversions
This example stores a private original and shows a thumbnail when the worker has produced it:retry_after above the job timeout, then start a worker:
Direct uploads with S3 Multipart
For large files, a custom upload interface can send parts from the browser to S3 over short-lived signed URLs. Laravel authorizes the session and issues signatures. S3 receives the bytes and reports which parts are already present.Multipart is a server-side integration API. It does not replace the standard File Upload picker or register browser control routes. Use the examples below to connect a custom upload interface to your application’s authorized endpoints and save flow.
Install the session tables
config/filament-flex-fields.php under file_upload.resumable:
Register the service
Use an unscoped S3 disk for the Multipart service. The service writes itsprefix directly as an object key, so leave the disk’s root empty for this workflow. Add this binding in your application service provider’s register() method:
Keep the policy stable while sessions are active. A session created under different policy values will be rejected by the new policy.
Create, resume and complete a session
Use the same ownership pattern as local chunks. Derive$scope from the authenticated user and the record they are allowed to edit. Save the server-owned association between the upload and the record, and rebuild that scope with a fresh policy check for each request.
Each snippet belongs in its corresponding authenticated endpoint. Validate inputs and apply your account and record quotas before starting a session:
Upload a signed part from the browser
Use the session’s returnedpartBytes, even when it differs from your preferred size. Number parts from one. On reconnect, ask the resume endpoint which parts are already present and request fresh URLs for missing parts.
sha256Parts, compute the digest for each exact part in a secure browser context and pass the Base64 digest to your signing endpoint. Pass the validated map as the fourth argument to signParts():
Configure browser CORS
For direct part uploads fromhttps://admin.example.com, add a rule like this in the S3 console. Add each real origin explicitly and allow the headers returned by your signing endpoint:
GET or HEAD as well if your frontend reads objects through cross-origin JavaScript requests. Standard image tags and downloads have their own browser rules. CORS permits the browser request. The signature and the bucket’s access policy still control access. Amazon S3 CORS
Validate and save the completed object
Completion confirms that S3 assembled the expected object. Perform your final size, content and authorization checks before accepting it into the application. For example, promote a completed PDF to permanent storage using Media OS:$document->path on your authorized record and make acceptance idempotent using the upload session ID. Remove the temporary object only after the database records the successful acceptance. Keep a cleanup path for rejected, abandoned and rolled-back uploads. Media OS inspects the stream through the application during this step, so size your application resources for the validation and processing workload. Media OS storage API · Save and recovery
Cancel and clean up S3 uploads
The local
fff:uploads:prune command handles local chunk sessions. S3 abort and lifecycle rules cover incomplete cloud transfers. Keep permanent media outside every temporary expiration prefix.
Here is a rule for the example’s temporary prefix. Add it to your bucket’s existing rules. Choose a duration that covers your longest permitted session:
Verify your setup
- Run the storage probe, then save and reopen a private file. A fresh signed preview should work and the same object URL without its signature should be denied.
- For queued thumbnails, save once with the worker stopped, check the pending state, then start the worker and confirm the preview switches to the thumbnail.
- For Multipart, upload at least two parts. Interrupt one request, reconcile the session, resume the missing parts and confirm the saved file matches the original.
- Cancel a separate Multipart upload after its first part and verify that storage no longer lists it as active.
- Test retention with temporary fixtures in an isolated prefix. Confirm that your active originals and variants remain accessible.