I have tried below mime types for validating PDF files.but none of them doesnt pass the validation .
$rules = [
....
"file" => "required|mimes:application/pdf, application/x-pdf,application/acrobat, applications/vnd.pdf, text/pdf, text/x-pdf|max:10000"
....
]
Just add file extension
$rules = [
"file" => "required|mimes:pdf|max:10000"
]
From laravel Docs:
Even though you only need to specify the extensions, this rule actually validates against the MIME type of the file by reading the file's contents and guessing its MIME type.
Update:
Starting from Laravel 5.2, you could validate file upload against full MIME type, new validation rule called: mimetypes
.
$rules = [
"file" => "required|mimetypes:application/pdf|max:10000"
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With