How to get file in action form

Hi, i have this modal form on list page and i need to get file in submit method, but i do not know how, is it possible? under data is just string with file name that not exists.

class ListPayments extends ListRecords
{
    protected static string $resource = PaymentResource::class;

    protected function getHeaderActions(): array
    {
        return [
            Actions\Action::make('create')
                ->label('Import')
                ->action(function (array $data) {
                    $this->save($data);
                })
                ->modalHeading('Import payments')
                ->form([
                    Select::make('type')
                        ->options([
                            'raiffeisenbank' => 'Raiffeisenbank CSV Payment export',
                            'default' => 'Default system export',
                        ])
                        ->required(),
                    FileUpload::make('file')
                        ->acceptedFileTypes(['text/csv', 'text/plain'])
                        ->getUploadedFileNameForStorageUsing(function (TemporaryUploadedFile $file) {
                            return (string) Str::uuid() . '.' . $file->getClientOriginalExtension();
                        })
                        ->required()
                        ->helperText('Imported payments will be pared with current records and edited or create new records'),
                ])
                ->modalButton('Import')
        ];
    }

    public function save(array $data)
    {
        $file = $data['file'];

        dd($file);
    }
}


Thanks for any help
Was this page helpful?