2016-12-19 1 views
-2

私はcpanelにアップロードして自分のサイトにファイルをアップロードするときにlocalhostでうまく動作するcodeigniterに関するプロジェクトを持っていますexample.comは現在この要求を処理できません。 HTTP ERROR 500 なぜですか?誰が私に何をすべきか教えてもらえますか?codeigniterにファイルをアップロードすると、なぜウェブサイトが現在このリクエストを処理できないのですか? HTTP ERROR 500

public function doupload($id,$action) 
{ 

    $config['upload_path']   = 'SliderImages/'; 
    $config['allowed_types']  = 'gif|jpg|png|jpeg|psd|pdf|tiff'; 
    $config['overwrite']   = TRUE; 
    $config['encrypt_name']   = false; 
    $config['max_size']    = 10000000; 
    $config['max_width']   = 999999; 
    $config['max_height']   =99999; 

    $this->upload->initialize($config); 
    $files = $_FILES; 

    if($action == "insert") 
    { 


      if($_FILES['slide_image']['name'] !== '') 
      { 

        $_FILES['userfile']['name']= $files['slide_image']['name']; 
        $file_name = $_FILES['userfile']['name']; 
        $name =explode('.',$file_name); 
        $_FILES['userfile']['name'] = $id. '.' .$name[1]; 
        $_FILES['userfile']['type']= $files['slide_image']['type']; 
        $_FILES['userfile']['tmp_name']= $files['slide_image']['tmp_name']; 
        $_FILES['userfile']['error']= $files['slide_image']['error']; 
        $_FILES['userfile']['size']= $files['slide_image']['size']; 

        //$this->upload->do_upload(); 
        if (!$this->upload->do_upload()) 
        {        
         $error = array('error' => $this->upload->display_errors());   
         return $error; 
         //print_r($error);die(); 
        } 
        else 
        { 
         $msg = array('upload_data' => $this->upload->data());    
         return $this->upload->data('file_name'); 

        } 

      } 

    } 


} 
+0

さて、サーバーのログを確認してください、または少なくともPHPのエラーを表示して問題の詳細を確認してください –

+0

PHPのバージョンを確認してくださいあなたのサーバーはあなたのコードと互換性があります。我々は最新バージョン7.0 – Xabby

+0

を持っているので、それが最新のものに設定されていればそれを5.6に設定してくださいPHPバージョン – Xabby

答えて

1

システム/ライブラリ/ upload.php のチェック。 。 "保護された関数_ファイル_ MIMEタイプ" を検索してください。 。 変更コード

$finfo = @finfo_open(FILEINFO_MIME); 
     if (is_resource($finfo)) // It is possible that a FALSE value is returned, if there is no magic MIME database file found on the system 
     { 
      $mime = @finfo_file($finfo, $file['tmp_name']); 
      finfo_close($finfo); 

      /* According to the comments section of the PHP manual page, 
      * it is possible that this function returns an empty string 
      * for some files (e.g. if they don't exist in the magic MIME database) 
      */ 
      if (is_string($mime) && preg_match($regexp, $mime, $matches)) 
      { 
       $this->file_type = $matches[1]; 
       return; 
      } 
     } 

。 〜 。 。

if (function_exists('finfo_file')) 
     { 

      $finfo = @finfo_open(FILEINFO_MIME);    
      if (is_resource($finfo)) // It is possible that a FALSE value is returned, if there is no magic MIME database file found on the system 
      { 
       $mime = @finfo_file($finfo, $file['tmp_name']); 
       finfo_close($finfo); 

       /* According to the comments section of the PHP manual page, 
       * it is possible that this function returns an empty string 
       * for some files (e.g. if they don't exist in the magic MIME database) 
       */ 
       if (is_string($mime) && preg_match($regexp, $mime, $matches)) 
       { 
        $this->file_type = $matches[1]; 
        return; 
       } 
      } 
     } 

。 。 私のエラーでそれを解決しました、この仕事もあなたのために解決しましたcm30w

関連する問題