what my problem is why my code unable to store .png file in database and uploads folder, but other than file like .jpg, .gif I successfully insert to database and uploads folder, I had include $config['allowed_types'] = 'png' as well, in addition, here is what I var_dump out the error message “The filetype you are attempting to upload is not allowed.” , Any idea how to solve my problem?
here is my code:
$upload_file_name = '';
$config['upload_path'] = '/var/www/html/uploads/';
$config['allowed_types'] = 'jpg|gif|png';
$config['max_size'] = 100000;
$config['overwrite'] = TRUE;
$this->load->library('upload', $config);
if(!$this->upload->do_upload('receipt_attachment'))
{
$error = array('error' => $this->upload->display_errors());
$errormessage = $this->upload->display_errors();
$this->session->set_flashdata('error', $errormessage);
redirect('home/add_product');
}else{
$upload_data = $this->upload->data();
$upload_file_name = $upload_data['file_name'];
}
thanks
Have you taken a look at this thread regarding invalid mime type?
http://codeigniter.com/forums/viewthread/204725/
Basically it might be (depending on your version of CI) that you have the older un-patched version that has trouble interpreting some png mime-types.
Take a read and try those solutions, and/or update to the newest CI code.