If you are having issue on uploading the file in CodeIgniter, there is a bug with the File Upload Class in the _file_mime_type function ( or File Upload Class - MIME type detection issue).
Please check one of the following steps to fix the issue;
1. Uploading any image with the following config would generate the error ‘The filetype you are attempting to upload is not allowed.’:
2. Changing ‘allowed_types’ to ‘*’ allows the file to be uploaded, however the upload data array ( $this->upload->data() ) contains an error:
3. Looking at system/libraries/Upload.php , Line 1058 tries to use an array value that does not exist.
Please check one of the following steps to fix the issue;
1. Uploading any image with the following config would generate the error ‘The filetype you are attempting to upload is not allowed.’:
$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:
[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.
@exec('file --brief --mime-type ' . escapeshellarg($file['tmp_path']), $output, $return_code); // Changed to: @exec('file --brief --mime-type ' . escapeshellarg($file['tmp_name']), $output, $return_code);
No comments:
Post a Comment
Please post any queries and comments here.