These examples use FlexFileUpload and FlexImageUpload from Bjanczak\FilamentFlexFields\Filament\Forms\Components. Limits apply independently to each rendered field.
Recommended presets
The recommended preset enables a 5 MiB max file size, create-form path authorization, removal/replacement cleanup, open/download actions and focus outline. It does not install antivirus or automatically enable conversions.
Select a type preset without the other recommended settings:
Exact MIME allow-list
Content is inspected rather than trusting the browser’s MIME declaration. Add extension restrictions when filenames must also match a format policy:
Executable rejection is an additional filename/type guard, not antivirus. Active formats such as HTML or SVG need an appropriate policy/sanitizer if allowed.
Per-file size
Sizes are KiB: this permits files from 10 KiB to 8 MiB. Global PHP, web-server and Livewire temporary-upload limits must also allow your chosen maximum.
File count and aggregate size
This requires at least one file, allows five files, limits each to 5 MiB and the field total to 15 MiB. Aggregate limits do not increase the per-file limit.
Image dimensions
These validate the input. maxImageWidth()/maxImageHeight() instead configure output optimization dimensions; they are not a substitute for dimension validation.
Application rules
Use native Laravel rule objects or closures for business validation. The built-in requirements description can summarize declared standard limits but cannot infer arbitrary custom rules; describe those with emptyStateHint().
URL and webcam files follow the same per-file admission checks, including size, type, dimensions and custom rules. URL import also validates before returning its staged preview. Aggregate/count rules and final Media OS scanning remain at their appropriate field/save boundaries.
Private local storage
Public images
Configure Laravel’s public storage link. Visibility should reflect whether users may access a file without authorization.
Configure Laravel disk credentials, permissions, signing and browser delivery. Private signing failure does not fall back to public links.
Scoped directories
For a directory determined by a saved record:
Use trusted server values. createFormStrategy() enables the field’s create-form path authorization strategy:
Explicit record paths still require your application’s record/tenant authorization.
Filename generation
Random filenames avoid collisions by default. Supply your own generator when needed:
Do not include directory segments. Media OS refuses to overwrite existing destinations. Keep client filenames for display instead of trusting them as executable storage paths:
preserveFilenames() is inherited and available when your workflow explicitly needs it, subject to destination collision/path protections.
The companion state records technical information such as original name, MIME, size and image dimensions. Use a model JSON column and array cast if you want to persist that state. For user-editable alt/caption/tags use the separate information editor, with a different state path.
Open, download and read-only
Action visibility follows these settings and file state. An optimized preview may show a thumbnail, while open/download links refer to the original.
Removal and replacement
Removal cleanup deletes the field’s owned file/bundle. Replacement cleanup runs after the new record reference is accepted so a failed save can retain the old attachment. If another part of your application shares references to the same file, use your own ownership policy before enabling destructive cleanup.
Reconcile removed baseline attachments after save:
This operates on the field’s known baseline; it does not scan a shared directory and guess which objects are orphaned.
Disable these behaviors individually when your application owns retention:
Register the required scanner in your application. Native field restrictions still apply alongside the engine policy.
Processors and application context
Register named processors through MediaExtensions. Processor example.
For advanced write configuration, return a MediaWrite preserving the field/record ownership:
A custom mediaAdapter() must supply references compatible with this field. Use the dedicated Spatie field for UUID state instead of switching a disk field’s adapter to Spatie. Last modified on October 16, 2026