FileUpload directly in to the field

protected function getHeaderActions(): array
    {
        return [
            Action::make('terns')
                ->form([
                    FileUpload::make('terms')
                        ->reactive()
                ])
                ->action(function($data) {
                     $filecontent = file_get_contents(storage_path('app/public/' . $data['terms']));
                    unlink(storage_path('app/public/' . $data['terms']));
                })
                ->label('Upload Transaction file')
                ->icon('heroicon-o-folder-open'),
        ];
    }


This is my old code and this works just fine but i want the file upload like the screenshot and that it can read the content of the CSV with the terms inside and that it fills out the terms so that you dont have to add it yourself
image.png
Was this page helpful?