无法使用codeigniter在AWS [Ubuntu]上传文件

无法使用codeigniter在AWS [Ubuntu]上传文件

问题描述:

I have AWS instance with Ubuntu and PHP configured. Every things work perfect. Only file upload not working. Application developed in PHP [codeigniter]

$this->load->library('form_validation');
$config = [
            'upload_path'    =>  "./data/user-avatar",
            'allowed_types'  =>  'gif|jpg|png|jpeg|JPEG',
            'encrypt_name'   =>   TRUE
         ];

        $this->load->library('upload',$config);

 if($this->upload->do_upload())
 {
    $data = $this->upload->data();
    echo $image = $data['file_name'];
 } else {
   echo "I am here in else";
 }

It executive else block directly. Application work fine on local.

  1. Checked upload dir permission its 777
  2. Check on phpinfo file upload is on

Any help to find of the error will be appreciated.

Thanks Prashant

我已经配置了Ubuntu和PHP的AWS实例。 每件事都很完美。 只有文件上传不起作用。 用PHP开发的应用程序[codeigniter] p>

  $ this-> load-> library('form_validation'); 
 $ config = [
'upload_path'=&gt  ;  “./data/user-avatar",
'allows_types'=>  'gif | jpg | png | jpeg | JPEG',
'encrypt_name'=>  TRUE 
]; 
 
 $ this-> load-> library('upload',$ config); 
 
 if if($ this-> upload-> do_upload())
 {  
 $ data = $ this-> upload-> data(); 
 echo $ image = $ data ['file_name']; 
} else {
 echo“我在其他地方”; 
  } 
  code>  pre> 
 
 

直接执行其他阻止。 应用程序在本地工作正常。 p>

  1. 已检查上传目录权限777 li>
  2. 检查phpinfo文件上载是否已打开 li> ol>

    任何帮助查找错误都将不胜感激。 p>

    谢谢 Prashant p> div>

Did you make sure your max upload size and max post are big enough on php.ini or your main php config file? it could not accept files bigger than X;

Also you could get the $data['error'] to see if you get any code > 0 and find a answer from this; maybe $error = $this->upload->display_errors(); could tell you more

Also check if your directory exists, using is_dir() to make sure you are not pointing to a different relative path (worth the check).