Hello i am anew to code igniter. My problem is When i am trying to upload an image during the project creation and i am getting the following error.
"A PHP Error was encountered
Severity: Notice
Message: Undefined property: Home::$upload
Filename: controllers/home.php
Line Number: 68
Fatal error: Call to a member function initialize() on a non-object in application/controllers/home.php on line 68"
My code is
class Home extends CI_Controller
{
public function index()
{
$this->load->model("content_model");
if (!$this->user->loggedin) {
$projects = $this->content_model->get_projects();
} else {
$projects = $this->content_model
->get_user_projects($this->user->info->ID);
}
$icons = $this->content_model->get_icons();
$this->template->loadContent("home/index.php", array(
"icons" => $icons,
"projects" => $projects
)
);
}
and the error occuring line 68 is this,
$image = "";
if ($_FILES['userfile']['size'] > 0
&& $this->settings->info->project_upload_icon) {
$this->upload->initialize(array(
"upload_path" => $this->settings->info->upload_path,
"overwrite" => FALSE,
"max_filename" => 500,
"encrypt_name" => TRUE,
"remove_spaces" => TRUE,
"allowed_types" => "gif|jpg|png|jpeg",
"max_size" => 3000,
"xss_clean" => TRUE,
"max_width" => 92,
"max_height" => 92
));
Please help me to sove this problem
$this->load->library('upload');- Bobot