Closed ARRW-Core closed 10 months ago
mime types for csv: 'text/csv', 'application/csv', 'text/x-comma-separated-values', 'text/x-csv'
Thanks @petrisorcraciun, #10762
Updated to the latest version, it now thorws this error when trying to upload the example csv (See attached)
Please tell me the mime type of your file
Please tell me the mime type of your file
Just the plain old csv you get when you click on the 'Download an example csv' link provided by filament. (Filament v3.1.47)
Edit: attached staff-importer-example.csv
I downloaded your file, uploaded it in my own project, and it worked fine. I'm gonna need more info.
Looks like it is only a problem on Firefox. Works on chrome and edge. Firefox must be doing something silly.
Regards,
Joshua Hartmann Senior Web Application Developer
E @.***
From: Dan Harrin @.> Sent: Monday, January 15, 2024 8:13:13 PM To: filamentphp/filament @.> Cc: Joshua Hartmann @.>; Manual @.> Subject: Re: [filamentphp/filament] Filamentphp ImportAction - Unable to import .csv file - File of invalid type - Firefox Browser (Issue #10732)
I downloaded your file, uploaded it in my own project, and it worked fine. I'm gonna need more info.
— Reply to this email directly, view it on GitHubhttps://github.com/filamentphp/filament/issues/10732#issuecomment-1891796691, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AUJEZ7OMZXE65K3MCBSH2MDYOT6LTAVCNFSM6AAAAABBUEVQWWVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOJRG44TMNRZGE. You are receiving this because you are subscribed to this thread.Message ID: @.***>
Just tried in Firefox and it seems fine for me
This is occurring with my instance of Filament - using the csv provided by the importer itself.
I'm using Firefox, Laravel v11, and v3.2.52 of Filament. If I rename the file to .txt it works fine. If I use Edge/Chrome, it works fine.
Firefox looks to be detecting the CSV files as "application/vnd.ms-excel" and not text/csv, et al.
https://codepen.io/GrizzlyStu/pen/YzjZjez - This allows you to interrogate the mime-type that your browser interprets it as.
Adding "application/vnd.ms-excel" to CanImportRecords.php solves this issue for Firefox users.
I created a PR for this, just in case.
Package
filament/filament
Package Version
v3.1.36
Laravel Version
v10.40.0
Livewire Version
^3.3
PHP Version
PHP 8.2.13
Problem description
Cannot upload .csv file that is downloaded with download example csv file
Expected behavior
By directly changing the .csv to .txt, it is possible to upload the file.
Steps to reproduce
Reproduction repository
https://github.com/ARRW-Core/filament_csv_import_issue.git
Relevant log output
No response