Codeiginitor do_upload在生产服务器上出错

时间:2016-12-31 07:28:45

标签: codeigniter

我正在使用简单的ci文件上传类,它在localserver上运行正常但是当它转移到生产服务器时它不起作用,它只是说页面没有响应..

任何人都可以为此提供帮助..

请检查我的代码

    <?php

class Upload extends CI_Controller {

        public function __construct()
        {
                parent::__construct();
                $this->load->helper(array('form', 'url'));
        }

        public function index()
        {
                $this->load->view('upload_form', array('error' => ' ' ));
        }

        public function do_upload()
        {
                $config['upload_path']          = './assets/';
                $config['allowed_types']        = 'gif|jpg|png';
                $config['max_size']             = 100;
                $config['max_width']            = 1024;
                $config['max_height']           = 768;

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

                if ( ! $this->upload->do_upload('userfile'))
                {
                        $error = array('error' => $this->upload->display_errors());

                        $this->load->view('upload_form', $error);
                }
                else
                {
                        $data = array('upload_data' => $this->upload->data());

                        $this->load->view('upload_success', $data);
                }
        }
}
?>

1 个答案:

答案 0 :(得分:0)

您需要一个目标目录,用于上传的图像集文件权限为777。