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!
No description
6 Replies
Dennis Koch
Dennis Koch5mo ago
Probably some bad mime type
BasherDesigns
BasherDesignsOP5mo ago
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(); }),
Dennis Koch
Dennis Koch5mo ago
Check what PHP reports on the mime type of your CSV. What program did you create this with?
BasherDesigns
BasherDesignsOP5mo ago
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
Dennis Koch
Dennis Koch5mo ago
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
BasherDesigns
BasherDesignsOP5mo ago
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 !
Want results from more Discord servers?
Add your server