codeigniter upload “The filetype you are attempting to upload is not allowed”
Filed Under (codeigniter, php) by admin on 13-04-2010
Tagged Under : codeigniter, php
Error when uploading your file using codeigniter upload
“The filetype you are attempting to upload is not allowed”
Causes:
1. Invalid file type uploaded by the user your uploading (.doc when only .xls is allowed)
2. The file uploaded is not within the specified file types added in the upload config
3. Mime type error in codeigniter caused by the mime type of the extension does not match the mime type specified in /application/config/mimes.php
Start by checking what is the mime type of the file your uploading
$data = array('upload_data' => $this->upload->data());
$mimetype= $data['upload_data']['file_type'];
echo $mimetype;
then check in the mimes.php if that mime type matches the extension you want to upload
Example:
word document
'doc' => 'application/msword'
excel file has many mime types, if its missing just add it in the array
'xls' => array('application/excel', 'application/vnd.ms-excel','application/x-msexcel')


