0
我似乎有一個在CodeIgniter
文件上傳的問題導致標題內的錯誤。我將文件上傳工作在不同網站上的同一臺服務器上,這就是爲什麼我認爲相同的代碼可用於此上載。第二個問題發生在我嘗試upload
。Codeigniter文件上傳 - 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
我更困惑,這是工作在其他網站上的同服務器,但不是這一個。所有的設置似乎也完全一樣。任何幫助將不勝感激。
您的代碼看起來不錯...您可以通過逐步添加中斷點來測試此問題... – chhameed
也會發布您的.log文件。你可以在那裏發現錯誤 – chhameed
@chhameed我該怎麼做(添加中斷點)?我認爲這可能與我的Codeigniter版本有關,因爲新網站正在使用更新的版本。 – Jake