CSV can't validate

When I try to upload a csv file using text/csv it never validates. The temp file has a .txt estension. Any idea?
Forms\Components\FileUpload::make('import_file')
->label('Import CSV')
->disk('local')
->acceptedFileTypes(['text/csv'])
->preserveFilenames(),
Forms\Components\FileUpload::make('import_file')
->label('Import CSV')
->disk('local')
->acceptedFileTypes(['text/csv'])
->preserveFilenames(),
3 Replies
Dan Harrin
Dan Harrin2y ago
make sure csv is allowed in your livewire upload validation i havent had this issue before also, considering it is just plain text, validating text/csv is not really better than any other .txt validation your app will still be able to read the file regardless of the extension
Mack H
Mack HOP2y ago
First, thanks for always helping out man. One day I owe you a 🍺. I completely agree there is no great solution here. I could write a custom validation rule which I might, but.here is a working bandaid. ->acceptedFileTypes(['text/csv','text/plain'])
Mack H
Mack HOP2y ago
Here is some more info if anyone concerned: https://github.com/livewire/livewire/discussions/4636
GitHub
Files with extension .csv uploads as .txt files · livewire livewire...
Description Files with extension .csv uploads as .txt files. Steps to reproduce Try to upload .csv file. In livewire-tmp folder it will be .txt. Context Livewire version: 2.10.1 Laravel version: 8....
Want results from more Discord servers?
Add your server