2017-01-16 128 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上传库存在问题。