hi its my first time here. i really dont know what's wrong with my codes. iam trying to upload file to database yet when i click the upload button, an error would occur.. (object not found) hope someone can help me...
btw, heres my code snippet
function do_upload()
{
    $config['upload_path'] = './uploads/';      
    $config['allowed_types'] = 'gif|jpg|png|doc|txt|pdf';
    $config['max_size'] = '5000';
    $config['max_width']  = '2500';
    $config['max_height']  = '2500';
    $config['remove_spaces']= 'true';
    $this->load->library('upload', $config);
    $data= array('userfile' => $this->upload->do_upload());
    //DEFINE POSTED FILE INTO VARIABLE
    $name= $data['userfile']['name'];
    $tmpname= $data['userfile']['tmpname'];
    $type= $data['userfile']['type'];
    $size= $data['userfile']['size'];
    //OPEN FILE AND EXTRACT DATA /CONTENT FROM IT
    $fp     = fopen($tmpname, 'r');
    $content= fread($fp, $size($tmpname));
    $content= addslashes($content);
    fclose($fp);
    if ( ! $this->upload->do_upload())
    {
        $error = array('error' => $this->upload->display_errors());
        $this->load->view('upload', $error);
    }   
    else
    {
        $data = array('userfile' => $this->upload->data());
        $this->load->database();
        $ret=$this->db->insert($name, $type, $size, $content);
        unlink($tmpname);
        //$this->load->database();
        //$this->load->view('upload', $data);
    }
 }
 
     
    