2016-11-15 106 views
2

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

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 

任何人都可以帮我解决问题吗?

回答

0

我终于解决了这个问题。这是由于php.ini中的“extension = php_fileinfo.dll”导致的。这是Codeigniter 3.1.2的要求。