我有一个CodeIgniter项目假定2nd_c,另一个CodeIgniter项目假定1st_c。我想将文件和图像上载到1st_c项目,但它引发路径错误“The upload path does not appear be valid”我已加载“upload”库,下面是我的代码
$config=array();
$config['upload_path'] = '../assets/uploads/jobs';
$config['allowed_types'] = 'gif|jpg|jpeg|png';
$config['overwrite'] = false;
$config['max_size'] = 3000;
$config['remove_spaces'] = true;
$config['max_filename'] = 10;
$config['file_ext_tolower'] = true;
$this->upload->initialize($config);
if($this->upload->do_upload('pic')){
$udata = array('upload_data' => $this->upload->data());
$jobimage = $udata['upload_data']['file_name'];
$data['j_image'] = $jobimage;
}else{
$errors = $this->upload->display_errors();
echo "<pre>"; print_r($errors); echo "</pre>";
exit;
}
“../assets/uploads/jobs”这是我的1st_c项目,它在本地主机上工作正常,但在服务器上抛出错误。我已经尝试了“FCPATH”,但没有运气。
2条答案
按热度按时间5t7ly7z51#
处理配置项文件夹时,请使用
APPPATH
或base_url()
。或
文件夹结构应为
gfttwv5a2#