Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

phpMick's avatar

Can't validate MIME type of XLS file.

Hi,

I am trying to validate an XLS file (Excel 97-2003 Worksheet)
The mime type is application/vnd.ms-excel.

It won't pass this test:

 $this->validate($request, [
            "glazing" => "mimes:xls,xlm,xla,xlc,xlt,xlw,xlsx,xlam,xlsb,xlsm,xltm"

        ]);

0 likes
2 replies
jeroenherczeg's avatar

I have the same problem, i use form request

$rules['import_file_seeders_file'] = 'required|mimes:csv,xls,xlsx';

'import_file_seeders_file.mimes' => 'This file type is not allowed',

All files give me type not allowed.

I also tried this:

$rules['import_file_seeders_file'] = 'required|mimes:csv,xls,xlsx,text/csv,text/plain,application/csv,
            text/comma-separated-values,application/excel,application/vnd.ms-excel,application/vnd.msexcel,
            text/anytext,application/octet-stream,application/txt,
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet';
phpMick's avatar

I gave up and just checked the extension. Figured that was better than nothing.

Please or to participate in this conversation.