Skip to content

Images and uploads ​

An image inserted into a rich editor is stored at once, so whoever saves keeps it, even if they are not the one who uploaded it.

  • When a save puts it in the record, it belongs to the record, like any other Filament upload.
  • Discarding the draft deletes the images nobody saved.
  • Images removed before saving are deleted by php artisan filament-collaboration:prune-uploads, scheduled daily for images older than prune_uploads_after hours. Undo can bring an image back until then. Your scheduler must be running (php artisan schedule:work, or cron).

Upload fields work the same way. A file is checked against the field's own rules (type, size, count) and stored the moment it finishes uploading, so everybody sees it at once and anybody's save keeps it. The list of files is shared like a repeater's items: adding, removing and reordering merge. A browser can only add files stored for this draft, or files the record already has.

A file Alice uploaded, in Bob's form

If you use Filament's preventFilePathTampering(), also allow files stored for the draft, as a colleague's file is not yet one of the record's:

php
FileUpload::make('gallery')->preventFilePathTampering(allowFilePathUsing: fn (string $file): bool => app(SharedUploads::class)->isStored($file));

Media library and Curator fields, which save through a relationship, still merge on save.

Released under the MIT License.