我似乎在CodeIgniter
中遇到文件上传问题,导致标题中出现错误。我将文件上传工作在不同网站上的同一台服务器上,这就是为什么我认为相同的代码适用于此上传。问题发生在第二次我尝试upload
。
以下是我目前在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 :(得分:0)
CodeIgniter本身存在问题。 3.1.2上传库存在问题。