FilamentF
Filament3y ago
3 replies
Demon-CZ

Get size of file in file upload

I am trying to get the file size from the upload and then save this value to column called size. Any help please how can it be done? 🥺

error: https://flareapp.io/share/47qKNq0m

Forms\Components\FileUpload::make('path')
                            ->storeFileNamesIn('name')
                            ->directory('projects')
                            ->afterStateUpdated(function (Closure $set, $state) {
                                $set('size', $state->getSize());
                            }),
Flare
App\Filament\Resources\ProjectResource\RelationManagers\AttachmentsRelationManager::App\Filament\Resources\ProjectResource\RelationManagers{closure}(): Argument #1 ($set) must be of type Closure, Filament\Forms\Set given, called in /var/www/html/vendor/filament/support/src/Concerns/EvaluatesClosures.php on line 35 - The error occurred at http:/...
Solution
Change Closure to either Set or callable.
Was this page helpful?