我正在尝试创建一个多图像上传器,我遇到了这个链接。我对下面的代码感到困惑,链接是我必须有 2
$this->upload->do_upload();
运行我的代码的函数或如何使用
$this->upload->initialize($config);
在以下情况下?
代码:
//Image Upload Function
$conceptOne = 'conceptOne';
$conceptTwo = 'conceptTwo';
$location = $_SERVER['DOCUMENT_ROOT'].'/_assets/quote/uploads/';
$folderName = $this->quote->getCompanyDetails()->companyName;
$folderName = str_replace(" ", "_", $folderName);
$folderName = strtolower($folderName);
if(!is_dir($location.$folderName))
{
mkdir($location.$folderName);
chmod($location.$folderName, 0777);
//Set File Settings
$config['upload_path'] = $location.$folderName;
$config['allowed_types'] = 'jpg|png|pdf';
$config['file_name'] = $conceptOne;
$config['remove_spaces'] = TRUE;
$config['overwrite'] = TRUE;
$config['max_size'] = '1024';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
print_r($config);
if(!$this->upload->do_upload($conceptOne)) { #= try upload
$data['uploadError'] = array('uploadError' => $this->upload->display_errors()); #Error
$this->load->view('layout', $data);
} // Do upload
else{
$data = array('upload_data' => $this->upload->data($conceptOne));
}// end else
}// end if folder