[eluser]Unknown[/eluser]
There is a bug with the File Upload Class in the _file_mime_type function.
1. Uploading any image with the following config would generate the error 'The filetype you are attempting to upload is not allowed.':
Code:
$config = array(
'upload_path' => './uploads/',
'allowed_types' => 'gif|jpg|png'
);
$this->load->library('upload', $config);
2. Changing 'allowed_types' to '*' allows the file to be uploaded, however the upload data array ( $this->upload->data() ) contains an error:
Code:
[file_type] => cannot open `' (no such file or directory)
3. Looking at system/libraries/Upload.php , Line 1058 tries to use an array value that does not exist.
Code:
@exec('file --brief --mime-type ' . escapeshellarg($file['tmp_path']), $output, $return_code);
Changed to:
Code:
@exec('file --brief --mime-type ' . escapeshellarg($file['tmp_name']), $output, $return_code);
This seems to detect the proper MIME type.
----
System Info: PHP 5.2.11 (MAMP 1.0) - Mac OS X 10.6.8