2017-01-16 75 views
0

我似乎有一個在CodeIgniter文件上傳的問題導致標題內的錯誤。我將文件上傳工作在不同網站上的同一臺服務器上,這就是爲什麼我認爲相同的代碼可用於此上載。第二個問題發生在我嘗試uploadCodeigniter文件上傳 - IIS 7.5 HTTP錯誤500.0

這是我目前正在使用中的代碼我controller

public function bulk_product_upload_file() 
{ 
    $location_of_bulk_product_files = LOCATION OF FOLDER; 
    if ($this->is_post()): 
     if (is_uploaded_file($_FILES['userfile']['tmp_name'])): 
      $date_for_file = date("dmyHis"); 

      $config['upload_path'] = $location_of_bulk_product_files; //upload directory 
      $config['allowed_types'] = 'xlsx'; // allowed file types 
      $config['max_size'] = '100'; 
      $config['overwrite'] = TRUE; 
      $config['remove_space'] = TRUE; 
      $config['file_name'] = $date_for_file; 
      $this->load->library('upload', $config); 

      if($this->upload->do_upload()): 
      // I have also tried if($this->upload->do_upload('userfile')): that resulted in the same error 
       // file upload success 
      else: 
       // file upload failed 
      endif; 
     else: 
      $this->session->set_flashdata('message_error','Please select a file to upload.'); 
      redirect('main/create_bulk_product'); 
     endif; 
    else: 
     $this->session->set_flashdata('message_error','Sorry! Somthing went wrong, please try again.'); 
     redirect('main/create_bulk_product'); 
    endif; 
} 

而且error我收到: HTTP Error 500.0 - Internal Server Error The page cannot be displayed because an internal server error has occurred. Module FastCgiModule Notification ExecuteRequestHandler Handler PHP Error Code 0x00000000

我更困惑,這是工作在其他網站上的同服務器,但不是這一個。所有的設置似乎也完全一樣。任何幫助將不勝感激。

+0

您的代碼看起來不錯...您可以通過逐步添加中斷點來測試此問題... – chhameed

+0

也會發布您的.log文件。你可以在那裏發現錯誤 – chhameed

+0

@chhameed我該怎麼做(添加中斷點)?我認爲這可能與我的Codeigniter版本有關,因爲新網站正在使用更新的版本。 – Jake

回答

0

問題在於CodeIgniter本身。 3.1.2上傳庫存在問題。