Hi
i am trying to upload excel file i am also validating excel file but facing problem with excel file mime type validation here is code i am using for file
'file' => 'required|mimes:xls,xlsx'
i don't know how laravel is checking mime, where i can set missing mimes for excel files in laravel.
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.
A full listing of MIME types and their corresponding extensions may be found at the following location: http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types
it dose not worked for me, i created custom rule to check only excel file. i think there is some problem with mime validation rule or I'm doing something wrong, i have tried txt mime it is not validating txt file.
I tried validators provided by laravel but all doesnt seems to work.. That gave me an idea to try to validate using normal php and it works like a cham
$extensions = array("xls","xlsx","xlm","xla","xlc","xlt","xlw");
$result = array($request->file('import_file')->getClientOriginalExtension());
if(in_array($result[0],$extensions)){
// Do something when Succeeded
}else{
// Do something when it fails
}