php - Cant Upload doc format files in codeigniter -


$config['allowed_types'] = 'doc|doc'; 

i want upload doc format file cant upload doc format file written filetype attempting upload not allowed.

why?

how solve issue, add mimes file,

'doc'   =>  'application/msword',                 'docx'  =>  array('application/vnd.openxmlformats-officedocument.wordprocessingml.document', 'application/zip'),                 'xlsx'  =>  array('application/vnd.openxmlformats-officedocument.spreadsheetml.sheet', 'application/zip'), 

you can use function

 public function do_upload(){           $this->config =  array(                   'upload_path'     => dirname($_server["script_filename"])."/files/",                   'upload_url'      => base_url()."files/",                   'allowed_types'   => "gif|jpg|png|jpeg|pdf|doc|xml|docx|gif|jpg|png|jpeg|pdf|doc|xml|docx|xls|xlsx",                    'overwrite'       => true,                   'max_size'        => "1000kb",                   'max_height'      => "768",                   'max_width'       => "1024"                    );         $this->remove_dir($this->config["upload_path"], false);          $this->ci->load->library('upload', $this->config);         if($this->ci->upload->do_upload())         {             $this->ci->data['status']->message = "file uploaded successfully";             $this->ci->data['status']->success = true;             $this->ci->data["uploaded_file"] = $this->ci->upload->data();         }         else         {             $this->ci->data['status']->message = $this->ci->upload->display_errors();             $this->ci->data['status']->success = false;         }     } 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -