Uploading an image in Codeigniter shows error The upload path does not appear to be valid

前端 未结 10 1645
独厮守ぢ
独厮守ぢ 2020-12-18 11:54
$config[\'upload_path\'] = site_path().\'photos/\';
$config[\'allowed_types\'] = \'gif|jpg|png|jpeg\';
$config[\'max_size\'] = \'2048\';
$this->load->library(\         


        
10条回答
  •  南方客
    南方客 (楼主)
    2020-12-18 12:23

    Check your .htaccess file not to block application folder Check is uploads is CHMOD 777 Use var_dump(is_dir('/photos/')); to see is your directory exist! Finally try this:

        $config['upload_path'] = 'photos/';
        $config['allowed_types'] = 'gif|jpg|jpeg|png';
        $config['max_size'] = '1000';
        $config['max_width'] = '1920';
        $config['max_height'] = '1280';                     
    
        $this->upload->initialize($config);
    

提交回复
热议问题