F
Filament16mo ago
rabol

acceptedFileTypes reject valid file types

I have this on a Fileupload:
->acceptedFileTypes(['application/json', 'json', 'application/msword', 'docx'])
->acceptedFileTypes(['application/json', 'json', 'application/msword', 'docx'])
I have tried this as well:
->acceptedFileTypes(['docx'])
->acceptedFileTypes(['docx'])
but when I select a .docx file I get an error saying: 'File of invalid type'
15 Replies
wyChoong
wyChoong16mo ago
Checked Livewire upload rules?
rabol
rabolOP16mo ago
no, I checked the Filament docs!
wyChoong
wyChoong16mo ago
Laravel
File Uploads | Laravel
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
wyChoong
wyChoong16mo ago
Find the relevant doc on lw2 if you not on lw3
rabol
rabolOP16mo ago
Not really sure what your point is? v2 as v3 is still in beta There is a method on the FileUpload component which I try to use and it does not work as Expected
wyChoong
wyChoong16mo ago
Livewire
File Uploads | Livewire
A full-stack framework for Laravel that takes the pain out of building dynamic UIs.
petrisorcraciun
petrisorcraciun16mo ago
Stack Overflow
What is a correct MIME type for .docx, .pptx, etc.?
For older *.doc documents, this was enough: header("Content-Type: application/msword"); What MIME type should I use for new .docx documents? Also, for pptx and xlsx documents?
rabol
rabolOP16mo ago
yes, and as mentioned I have both the mimetype and the extension, and with the extension alone, none worked
wyChoong
wyChoong16mo ago
If not using the accepted file types, does it upload?
rabol
rabolOP16mo ago
->acceptedFileTypes(['application/json', 'json', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'docx'])
->acceptedFileTypes(['application/json', 'json', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'docx'])
but 'docx' alone should also work IMHO with this:
->acceptedFileTypes(['json', 'docx'])
->acceptedFileTypes(['json', 'docx'])
I can select the file, but get an error after
petrisorcraciun
petrisorcraciun16mo ago
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
wyChoong
wyChoong16mo ago
Without this does upload works?
rabol
rabolOP16mo ago
yes with this it works:
->acceptedFileTypes(['application/json', 'json', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'docx'])
->acceptedFileTypes(['application/json', 'json', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'docx'])
The mime type frol the Laravel documentation does not work, that was my initial try
awcodes
awcodes16mo ago
This is a Microsoft problem. They are notoriously bad with their mime types.
petrisorcraciun
petrisorcraciun16mo ago
if you look in the laravel documentation you will see that is a difference between mimetypes and mimes. 🙂
Want results from more Discord servers?
Add your server