file - 上传路径似乎无效”。 Codeigniter 文件上传

标签 file codeigniter upload

        $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 文件,则会收到此错误“上传路径似乎无效”。我将路径替换为绝对路径,然后我也收到此错误。
请建议我如何解决这个问题。`

最佳答案

该问题通常发生在调用 $this->load->library('upload', $config) 时。 ,可能是没有加载配置设置,所以在加载上传库后尝试添加以下语句。

$this->upload->initialize($config);

关于file - 上传路径似乎无效”。 Codeigniter 文件上传,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16690246/

相关文章:

php - 警告 : mysqli_connect(): (28000/1045): on Cpanel

java - 当我使用 Gdx.files.local(path) 时,Gdx 在哪里搜索?

php - 从数据库中选择数据,然后再次插入数据库 codeigniter

php - 在同一查询中使用 like、or、match 的 codeigniter 事件记录

java - 在不使用表单数据的情况下在 Spring 中上传文件

java - 使用文件协议(protocol)的 Jmeter HTTP 请求未获取所有文件

c++ - CodeEval 挑战 : Reverse strings in input file

python - 在 Python 中读取文件而不锁定它

php - 在sql中使用lat和long查找距离

javascript - 我可以使用任何 HTML 或 JavaScript API 在 input[type=file] 中获取文件的路径吗?