2013-11-25 67 views
0

這是我的前端代碼。這是一個小型的文件上傳,其中一個input文件上傳時發生內部服務器錯誤

<form class="" method="POST" action="<?php echo base_url();?>adminpanel/upload" enctype="multipart/form-data"> 

          <input type="file" name="file"> 
         <div class="widget-footer"> 
          <button class="btn btn-primary" type="submit">Save</button> 

         </div> 
         </form> 

當我打的保存按鈕,下面的PHP腳本執行:

function upload() 
    {  
      ini_set('upload_max_filesize', '10M'); 
      ini_set('post_max_size', '10M'); 
      if (!empty($_FILES)) 
     { 
      $config['upload_path'] = './uploads/'; 
      $config['allowed_types'] = 'gif|jpg|png'; 
      $config['max_size'] = '2000'; 


      $this->load->library('upload', $config); 
      if ($this->upload->do_upload()) 
      { //success 
       $data = array('upload_data' => $this->upload->data()); 
      } 


     } 
       redirect("/home"); 
    } 

但不是成功的文件上傳,我得到以下信息:

內部服務器錯誤 的服務器遇到內部錯誤或配置錯誤,無法完成您的請求。 請聯繫服務器管理員admin @ localhost並告知他們發生錯誤的時間以及可能導致錯誤的任何事情。 這個錯誤的詳細信息可在服務器錯誤可用的日誌

當我去到Apache日誌,有以下錯誤:

[Mon Nov 25 15:57:08 2013] [error] [client 127.0.0.1] Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace. 

這到底是怎麼回事?

+1

'redirect(「」)'?重定向到自己?所以你發佈到腳本,該腳本重定向到自己,沒有上傳完成,所以它重新導向到自身,等等...? –

+0

不,它會重定向到base_url! – MrD

回答

0

也許你應該打電話redirect("/");redirect(base_url().'adminpanel/');

或移動此重定向到的if (!empty($_FILES))花括號。

+0

做到了,但仍是同樣的問題! – MrD

+0

http://stackoverflow.com/questions/17669712/php-upload-and-internal-server-error這篇文章以某種方式與我的問題相關,但無法在我的WAMP服務器中找到FcgidMaxRequestLen 67108864。 – MrD

相關問題