2016-11-15 104 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的要求。