Fileinfo error during file upload

(chinaka) #1

Hello guys,

Here is a little story of how i cam about this error.

prior to this time i was using wamp64 and everything worked fine until i switched to IIS. I have checked the php.ini file to make sure the fileinfo extension is enabled but i still get the same error each time i tried to upload an excel or csv file using php spreadsheet,

Initially i was getting an mime_content_type error so i searched online and discovered that mime_content_type has been deprecated and fileinfo is the right method to use so i switched.

PHP Fatal Error – [yii\base\ErrorException]

Class ‘PhpOffice\PhpSpreadsheet\Reader\finfo’ not found

} catch (Exception $e) {
return false;


    //$type = mime_content_type($pFilename);

    $finfo = new finfo(FILEINFO_MIME);
    $type  = $finfo->file('path/filename');

    $supportedTypes = [

    return in_array($type, $supportedTypes, true);