dshxbrzgi090608692 2017-11-02 11:10
浏览 41
已采纳

无法使用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

  • 写回答

1条回答 默认 最新

  • douxing1353 2017-11-02 11:24
    关注

    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).

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥15 Oracle触发器记录修改前后的字段值
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题