Fatal error: Call to undefined method Upload::do_upload() -


i error when trying upload file.

this code

  class upload extends ci_controller {      function __construct() {         parent::__construct();          $this->load->model(array(                                   'm_campaign'                                    ,'m_upload'                                 )                             );          $this->load->helper(array(                                    'form'                                     ,'url'                                 )                             );      }      public function index()     {         $data = array(                         'select_campaign'   => $this->select_campaign(),                         'view'              => 'upload',                         'js'                => 'script_upload'                     );          $this->load->view('admin/template', $data);     }      function select_campaign(){         $select_campaign = $this->m_upload->table_campaign();         return $select_campaign;     }      function start_upload(){          if (!empty($_files)) {             $config = array(                                 'allowed_types' => 'jpg|xls|xlsx'                                  ,'upload_path'  =>  base_url('assets/media/excel/')                                 ,'max_size'     =>  1000000                                 ,'max_width'    =>  4024                                 ,'max_height'   =>  1768                                 ,'overwrite'    =>  true                             );             $this->load->library('upload', $config);              $this->upload->do_upload();         }         redirect('admin/upload');     } } }  

i've trying search still confuse.

thank here

it may because config parameter not intialize. try after

$this->load->library('upload', $config);     $this->upload->initialize($config); 

Comments

Popular posts from this blog

javascript - Laravel datatable invalid JSON response -

java - Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; -

sql server 2008 - My Sql Code Get An Error Of Msg 245, Level 16, State 1, Line 1 Conversion failed when converting the varchar value '8:45 AM' to data type int -