Codeigniter do_upload() silently fails on "success" Codeigniter do_upload() silently fails on "success" codeigniter codeigniter

Codeigniter do_upload() silently fails on "success"


$config['upload_path'] = 'uploads/category/'.$id.'/';        //echo $file_name;die;        //echo $config['upload_path'];        $config['allowed_types'] = 'gif|jpg|jpeg|png';        $config['max_size'] = '750';        $config['max_width'] = '1920';        $config['max_height'] = '1280';        $this->load->library('upload');         foreach ($_FILES as $key => $value) {            //print_r($key);            if (!empty($key['name'])) {                $this->upload->initialize($config);                if (!$this->upload->do_upload($key)) {                  // echo 'test';die;//                    rmdir('uploads/category/'.$id);                    $errors = $this->upload->display_errors();                    flashMsg($errors);                }}}

try this!


your giving maxwidth and maxheight as zero may be that was the problem check it.


(Reposting from comments):There was a typo/bug in system/application/config/mimes.php which caused the is_allowed_filetype() method to fail in do_upload();

Erronous:         ...        'gif' => array('image/gif', 'application/octet-stream'),        'jpeg' => array('image/jpeg', 'image/pjpeg', 'application/octet-stream'),        'jpg' => array('image/jpeg', 'image/pjpeg', 'application/octet-stream'),        'jpe' => array('image/jpeg', 'image/pjpeg', 'application/octet-stream'),        'png' => array('image/png', 'image/x-png', 'application/octet-stream'     );

// missing ) for final entry. – John Beech (aka Markavian)

Any errors in the CodeIgniter configuration files seem to fail silently, so any further errors are not reported. Found problem by debugging internal CI method to find out which line failed.