Matt Ellis
Matt Ellis

Reputation: 1393

Laravel Mime Type Validation (KML file)

I have an file upload on my form with a validation rule to check that it's a kml file:

return [
        'file' => 'required|mimes:kml',
        ...
    ];

However, when I upload a .kml file I get an 'The file must be a file of type: kml.' error.

Other than the file extension where else is the mime type being defined?

Upvotes: 3

Views: 1536

Answers (1)

Michael Nguyen
Michael Nguyen

Reputation: 1752

you have to specific correct kml mime which is application/vnd.google-earth.kml+xml

Read more @ https://laravel.com/docs/5.7/validation#rule-mimes

Also, this page gives you full mimes https://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types

Upvotes: -2

Related Questions