FilamentF
Filamentβ€’2y ago
SirAlyon

Error in Filament's ImportAction Feature

Hello everyone! I'm encountering an issue with Filament's new ImportAction feature, and I've updated Filament to version 3.1 to utilize this functionality. I've generated a test importer using the automatic class generation. Everything appears to be functioning correctly until I attempt to upload a file. After the upload, I encounter the following error:
fgetcsv(): Read of 8192 bytes failed with errno=21 Is a directory.

I'm unsure about where to begin debugging this error. Any advice or insights would be greatly appreciated.
Below is the relevant code snippet:


My Resource:
public static function table(Table $table): Table
    {
        return $table
        ->headerActions([
            ImportAction::make()
                ->importer(KiidMailPdfImporter::class)
        ])
     ...other code
    }


My Importer:
namespace App\Filament\Imports;

use App\Models\KiidMailPdf;
use Filament\Actions\Imports\ImportColumn;
use Filament\Actions\Imports\Importer;
use Filament\Actions\Imports\Models\Import;

class KiidMailPdfImporter extends Importer
{
    protected static ?string $model = KiidMailPdf::class;

    public static function getColumns(): array
    {
        return [
            ImportColumn::make('cstato')
                ->rules(['max:1']),
            ImportColumn::make('tuts')
                ->rules(['datetime']),
            ImportColumn::make('cisin')
                ->rules(['max:50']),

            ...other ImportColumn
        ];
    }

    ...other generated code


Thank you.. πŸ™‚
Was this page helpful?