Codeigniter provide us File Uploading Class to make our upload file routine more easily. I use File Uploading Class frequently on image file upload and there always no problem. Yesterday I try to upload EXE file and there said “The filetype you are attempting to upload is not allowed” even I have put the EXE file extension in File Uploading Class configuration.
$config['allowed_types'] = ‘exe|pdf|doc|txt|xls|zip|jpg|gif|png|swf’;
Then I open the File Uploading Class then I found that the file type for file that we upload compared to the MIME data in “config/mimes.php”
‘exe => ‘application/octet-stream’,
The “EXE” file type generated by browser when uploading, on my browser the EXE file know as “application/x-msdos-program”. So that’s why when I upload EXE file there always not allowed. We need add something to mimes file for EXE file , it should be like this
‘exe’ => array (‘application/octet-stream’,'application/x-msdos-program’),
This situation may happen to another file type. So if you face same situation you know what you should do