Hi everyone,
I'm working on a Laravel project using Filament v3, and I'm facing an issue with the FileUpload component when dealing with private files.
I need to store private user files (like images and documents) using the FileUpload component, and I'm storing them in storage/app/private. This works fine for uploading and displaying files on other parts of the application for example in Infolist - automatically generates temporary URLs for private files.
When editing a resource that has existing files uploaded through the FileUpload component, the existing files don’t load in the form, so it looks as if there are no files uploaded. As a result, if I submit the form without re-uploading, the field in the database is overridden with an empty value.
FileUpload::make('attachments')
->hint('some hint')
->label('some label')
->multiple()
->visibility('private')
->directory('user-attachments')
->disk('local')
->maxSize(10240)
->maxFiles(5);
'local' => [
'driver' => 'local',
'root' => storage_path('app/private'),
'serve' => true,
'throw' => false,
],
I should mention that i store it in json column with array cast in model.