the attachment field must be a file of type:
Can someone tell me what kicks this error message when trying to import a file? See image.
This app uses Spatie Media Library and I receive this error on production server, but works on dev. Trying to track this issue down!
Thanks!
6 Replies
Probably some bad mime type
Update, this import is using FileUpload, but I do receive the same error with Spatie. Here is the code for the import Reservations```
Actions\Action::make('ImportReservations')
->label('Import Reservations')
->color('warning')
->icon('heroicon-o-arrow-up-on-square')
->form([
FileUpload::make('attachment')
->acceptedFileTypes(['text/csv']),
])
->action(function (array $data) {
$file = public_path('storage/'. $data['attachment']);
// dd($file);
$this->importCsv($file);
Notification::make()
->title('Reservations Imported')
->success()
->send();
}),
Check what PHP reports on the mime type of your CSV. What program did you create this with?
CSV is exported from a web app. I also have a Image uploader using SpatieMediaLibraryUpload that does the exact same thing, I select images, they upload to tmp dir and when hit Submit, same file type error reporting its not image
Hm, I heard of similar problems before, but I am not sure what it was. I think something is converting the temporary files on upload
I'm going to do some more testing with local storage again, I believe it gave me the same issue but lets try this again and I'll report back !