Load upload file library same official doc:
Controller
Code:
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
class Careers extends CI_Controller {
function __construct()
{
parent::__construct();
$this->load->helper(array('form', 'url'));
}
public function do_upload()
{
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = 100;
$config['max_width'] = 1024;
$config['max_height'] = 768;
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload('userfile'))
{
$error = array('error' => $this->upload->display_errors());
$this->load->view('upload_form', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());
$this->load->view('upload_success', $data);
}
}
$this->load->library(array('session','javascript','encrypt','email','form_validation'));
$this->load->helper(array('text','html','email','lang','file','directory'));
$this->load->driver(array('session'));
$this->load->model('Careers_model','model');
public function index($lang=false)
{
$vars['lang'] =langhomename($lang);
$langid=langhomeid($lang);
$this->load->view('careers/index',$vars);
}
public function cvcareers($lang=false){
$vars['lang'] =langhomename($lang);
$langid=langhomeid($lang);
$this->model->cvcareers($vars);
}
}
The important thing to specify the directory and set chmod permissions.