【发布时间】:2013-05-17 09:57:42
【问题描述】:
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'doc|docx';
$config['max_size'] = '400';
$config['max_width'] = '1024';
$config['max_height'] = '768';
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
$this->load->view('upload_form', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());
$this->referral_model->postCVReferralInfo($m_id, $emp_id , $job_id, $name, $age , $gender,$country_id, $mobile, $email, $summary, $workExp, $education, $qualification, $offer, $sb_id);
header('location:'.$this->config->base_url().'index.php/member/referSuccess');
exit;
} `
如果我尝试上传 doc 文件,则会收到此错误“上传路径似乎无效”。我将路径替换为绝对路径,然后我也收到此错误。 请建议我如何解决这个问题。`
【问题讨论】:
-
你的上传文件夹在哪里???
-
uploads 文件夹在主文件夹内(应用程序文件夹、图像文件夹等放在主文件夹内)
-
确保目录是可写的。上面设置了什么chmod?
-
目录是可写的。
-
CodeIgniter 将仅在
$config['upload_path']为空白(不是)或 php 命令is_dir(upload_path)返回 false 时返回该错误消息。所以这表示找不到定义的路径。检查以确保“上传”文件夹与主 index.php 文件位于同一目录中,并且目录名称大小写相同(即上传而不是上传)
标签: file codeigniter upload