【问题标题】:do_upload function not working - codeigniter 3do_upload 功能不起作用 - codeigniter 3
【发布时间】:2016-11-15 14:33:10
【问题描述】:

我在 IIS 上配置了一个代码点火器项目。使用上传库在用户模型中上传图像时遇到问题。这是我的功能。

public function upload_image($file,$path, $url) {
        $image = time();
        //////////Remove any Old file with this name///////
        if (file_exists($path . $image))
            unlink($path . $image);
        ///////////////////////////////////////////////////

        $config['upload_path'] = $path;
        $config['allowed_types'] = 'jpg|png|gif|jpeg';

        $config['file_name'] = $image;
        $this->load->library('upload', $config);
        $this->upload->initialize($config);

        if (!$this->upload->do_upload($file)) {
            $this->session->set_flashdata('error', $this->upload->display_errors());
            return false;//redirect($url);
            // $this->session->set_flashdata('post', $this->input->post());
            // $this->reload($url, $this->upload->display_errors(), 'danger');
        } else {
            $upload_data = $this->upload->data();
            return $upload_data['file_name'];
        }
    } 

我是这样从控制器调用这个函数的

$path = 'assets/profileimages/';
$file = 'imagefile';
$imagepath= $this->users->upload_image($file,$path,'Users/addUser');

出现以下错误。

domainname currently unable to handle this request.

在日志中,我有以下错误。

404 Page Not Found: Users/assets

谁能帮我解决这个问题?

【问题讨论】:

    标签: php codeigniter


    【解决方案1】:

    我终于解决了这个问题。这是由于 php.ini 中的“extension=php_fileinfo.dll”未启用。这是 codeigniter 3.1.2 的要求。

    【讨论】:

      猜你喜欢
      • 2022-08-08
      • 2016-02-14
      • 1970-01-01
      • 2018-06-02
      • 2017-12-27
      • 2022-01-02
      • 1970-01-01
      • 1970-01-01
      • 2020-03-01
      相关资源
      最近更新 更多