phplaravellaravel-livewirelaravel-filament

Filament upload file not moving image to destination folder


I'm using Filament 3.2 on Laravel 12, I just moved the project on a new server. On the old server this problem did not happen. That's the definition of the field

    Forms\Components\FileUpload::make('file')
                    ->label(__('Badge File'))
                    ->directory(Badge::BADGE_DIR)
                    ->preserveFilenames()

When i try to upload the file, the file is correctly uploaded to livewire temp folder, the name is taken correctly, but when I hit "Save" the record is saved on the DB with the correct filename but the file is not moved on the destination folder. The destination folder already exists, has the same right permission than the temporary folder, all the livewire calls returns status 200, no error is recorded elsewhere. Still the file is not moved to final folder and it's cancelled from temp folder.

The storage:link is also properly set as other parts of the applications are able to write there.

I've tried also without preserveFilenames with no difference. What can it be? How can I debug the process?


Solution

  • Apparently, for some strange reasons, having the same permission rights on the temp folder and on storage was not enough. Following the guide I found here, I set the rights for all the folders to root as owner and to www-data as group. This is enough for livewire temp folder but seems not to the storage folder. At least not for livewire, because laravel is correctly able to write on the storage folder with this configuration.

    Anyway, as soon as I changed the owner of storage folder to www-data, everything started working. The strange thing is that I never received a permission denied error.