<form action=”CONTROLLER PATH” enctype=”multipart/form-data”>
<input type=”file” name=”file1″/>
<input type=”file” name=”file2″/>
<input type=”submit” name=”Upload”/>
</form>

<?php
####################################
$this->load->library(‘image_lib’);
$config1 = array(
‘upload_path’ => “./uploads/path1”,
‘allowed_types’ => “gif|jpg|png|jpeg”,
‘overwrite’ => TRUE,
‘max_size’ => “2048000”, // Can be set to particular file size , here it is 2 MB(2048 Kb)
‘max_height’ => “768”,
‘max_width’ => “1024”
);
$new_name = time().$_FILES[“file1”][‘name’];
$new_name=preg_replace(‘/\s+/’, ‘_’, $new_name);
$config1[‘file_name’] = $new_name;
$this->load->library(‘upload’, $config1);
if($this->upload->do_upload(‘file1’)){
$configer1 = array(
‘image_library’ => ‘gd2’,
‘source_image’ => “./uploads/path1/”.$new_name,
‘maintain_ratio’ => TRUE,
‘width’ => 197,
‘height’ => 176,
);
$this->image_lib->clear();
$this->image_lib->initialize($configer);
$this->image_lib->resize();
$file_name1=$config1[‘file_name’];
}
################################################
####################################
$this->load->library(‘image_lib’);
$config2 = array(
‘upload_path’ => “./uploads/path2”,
‘allowed_types’ => “gif|jpg|png|jpeg”,
‘overwrite’ => TRUE,
‘max_size’ => “2048000”, // Can be set to particular file size , here it is 2 MB(2048 Kb)
‘max_height’ => “768”,
‘max_width’ => “1024”
);
$new_name1 = time().$_FILES[“file2”][‘name’];
$new_name1=preg_replace(‘/\s+/’, ‘_’, $new_name1);
$config2[‘file_name’] = $new_name;
$this->upload->initialize($config2);
if($this->upload->do_upload(‘file2’)){
$configer2 = array(
‘image_library’ => ‘gd2’,
‘source_image’ => “./uploads/path2/”.$new_name1,
‘maintain_ratio’ => TRUE,
‘width’ => 1930,
‘height’ => 836,
);
$this->image_lib->clear();
$this->image_lib->initialize($configer2);
$this->image_lib->resize();
$file_name2=$config2[‘file_name’];
}
################################################
?>