Reputation: 5352
$configUpload = array();
$configUpload['upload_path'] = './directory_1/';
$configUpload['max_size'] = '6000';
$configUpload['max_width'] = '9500';
$configUpload['max_height'] = '9500';
$configUpload['allowed_types'] = 'png|jpg|jpeg|gif|bmp';
$this->load->library('upload',$configUpload);
$upload_1 = $this->upload->do_upload('product_image');
if($upload_1 === FALSE)
$product_data = $this->upload->data();
continue;
$config = array();
$config['upload_path'] = './directory_2/';
$config['max_size'] = '5000';
$config['max_width'] = '10000';
$config['max_height'] = '10000';
$config['allowed_types'] = 'png|jpg|jpeg|gif|bmp';
$this->load->library('upload', $config);
$upload = $this->upload->do_upload('product_image_2');
When I submit to upload, image files are in the same directory (directory_1).
Upvotes: 2
Views: 2427
Reputation: 51
Need To initialize your class
$configUpload = array();
$configUpload['upload_path'] = 'uploads/canvas_uploads/upload_save/';
$configUpload['allowed_types'] = 'png|jpg|jpeg|gif|bmp';
$configUpload['file_name'] = date("Ymd") . time();
$configUpload['overwrite'] = true;
$this->load->library('upload', $configUpload);
$this->upload->initialize($configUpload);
$upload_1 = $this->upload->do_upload('file_input');
$config['upload_path'] = 'uploads/canvas_uploads';
$config['allowed_types'] = 'jpg|png|jpeg|gif|bmp|tif';
$config['file_name'] = date("Ymd") . time();
$config['overwrite'] = true;
$this->load->library('upload', $config);
$this->upload->initialize($config);
$this->upload->do_upload("file_input");
Upvotes: 4