I create image upload code. this create directory first and then upload images to it.
In form I upload 3 images.
My Code is:
$dir_path = \'asset
Read manual from here CI image upload.
In codignator we use upload library to upload image .
you pass youe parameter according to your requirment
$config['upload_path'] = 'assets/images/product_images/'.$model."/";
$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())
{
$error = array('error' => $this->upload->display_errors());
$this->load->view('Your View', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());
$this->load->view('Your View', $data);
}