$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');
当我提交上传时,图像文件位于同一目录(directory_1)。
答案 0 :(得分:3)
需要初始化您的课程
$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");