here is my file upload process
// file upload process
$config['upload_path'] = UPLOAD_PATH ."/introduce/";
$config['allowed_types'] = UPLOAD_ALLOW_EXT;
$config['max_size'] = '10240';
$config['file_name'] = time();
$this->load->library('upload', $config);
foreach($_FILES as $key => $value)
{
if($_FILES[$key]['name'])
{
if (!$this->upload->do_upload($key))
{
var_dump($this->upload->display_errors());
alert('erro while file upload');
} else {
$upload_data = $this->upload->data();
${$key} = $_FILES[$key]['name'];
${"o".$key} = $upload_data['file_name'];
}
}
}
I have same code. worked in "/controller/1.php" deosn't work in "/controller/2.php"
error massage
A PHP Error was encountered Severity: Notice Message: Undefined property: Introduce::$upload Filename: admmode/introduce.php Line Number: 77
Fatal error: Call to a member function do_upload() on a non-object in /var/www/html/application/controllers/admmode/introduce.php on line 77