php - CodeIgniter doesn't load upload library -


i'm having problem loading codeigniter library,

i've built 3 (3) websites codeigniter, consider myself familiar framework.

the problem upload lib. i've tried multiple functions , still doesn't work.

i've tried the codeigniter example

in google can't find answers, have idea be?

class admin extends ci_controller {  public function __construct(){     parent::__construct();     $this->load->library('session');     $this->load->library('v');     $this->load->model('admin_model'); }  public function upload_a_thing($set = null){     $this->load->helper(array('form', 'url'));     if(!$set){         $this->load->view('admin/upload_a_thing');     }else{         $this->load->library('upload');         if (!$this->upload->do_upload('userfile')){             echo $this->upload->display_errors();         } else {              $file = $this->upload->data();             //          $product = $this->admin_model->get_products($id);             $newfilepath = $config['upload_path'].'try.jpg';             $file['file_name'] = str_replace(" ","_",$file['file_name']);             rename($config['upload_path'].$file['file_name'], $newfilepath);         }        } }    

codeigniter error

 undefined property: admin::$upload 

php error

fatal error: call member function do_upload() on non-object  

edited spary

        $config['upload_path'] = './media/imgs/products/';         $this->load->library('upload',$config);         if (!$this->upload->do_upload('userfile')){             echo $this->upload->display_errors();         } 

if form looks this:

<input type="file" class="input" name="logo"  /> 

then call do_upload() this:

 do_upload('logo'); 

if looks this:

 <input type="file" class="input" name="userfile" /> 

then call this:

 do_upload(); 

Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -