No field matches populate when importing a csv #124
-
I am sure I've missed a step somewhere. When I drag and drop the csv file, it uploads correctly, but the corresponding fields do not populate with the fields from the csv file. I am using:
For this example, I have a table called Posts with three columns: id (auto increment), title, author. Here is my ListPosts.php file: namespace App\Filament\Resources\PostResource\Pages;
use App\Filament\Resources\PostResource;
use Filament\Actions;
use Filament\Resources\Pages\ListRecords;
use Konnco\FilamentImport\Actions\ImportAction;
use Konnco\FilamentImport\ImportField;
class ListPosts extends ListRecords
{
protected static string $resource = PostResource::class;
protected function getHeaderActions(): array
{
return [
ImportAction::make()
->fields([
ImportField::make('title')
->required(),
ImportField::make('author')
->required(),
])
];
}
} When I manually update the table using the form, the data is saved accordingly. The closest issue I found was here where a user was getting an error that I also received when I tried to see if uploading an xlsx file would work. Not sure if the issues are related. Here is my config file: return [
'accepted_mimes' => [
'application/vnd.ms-excel',
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet',
'text/csv',
'text/plain',
'csv',
'txt',
'application/csv'
],
'temporary_files' => [
'disk' => 'local',
'directory' => 'filament-import',
],
]; |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 13 replies
-
More details: I've confirmed the csv files are saving under store/app/filament-import. Here is what I see after uploading a file: |
Beta Was this translation helpful? Give feedback.
-
Just made a PR to fix this issue with local disks, apparently my last PR fixing s3 broke not remote disks. Tested it with local disk as well as s3 disk and all tests passing, so it should be fine now |
Beta Was this translation helpful? Give feedback.
Just made a PR to fix this issue with local disks, apparently my last PR fixing s3 broke not remote disks.
Tested it with local disk as well as s3 disk and all tests passing, so it should be fine now
#125