Codeigniter:上传的图像权限在Web服务器中为600,图像不在网站中显示

时间:2015-07-13 07:45:41

标签: php codeigniter file-upload webserver

我使用codeigniter上传了我的图片,上传的图片没有显示在我的网站上,然后我去了filezilla并搜索了该文件,文件夹权限是755但文件权限是600,如果我将文件权限更改为644,则图像显示正常,但我无法为所有上传图片做这样的事情。那么,有什么方法可以解决它吗?

            $config['upload_path'] = './assets/images/';
            $config['allowed_types'] = 'gif|jpg|png';
            $config['max_size'] = '100';
            $config['max_width']  = '600';
            $config['max_height']  = '600';
            $config['file_name']  = $id;

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

            if(!$this->upload->do_upload())
            {
                $error = array('error' => $this->upload->display_errors());                 
                redirect('', $error);
            }
            else
            {
                chmod($config['upload_path'], 0755);
                redirect('');
            }

2 个答案:

答案 0 :(得分:0)

此试用代码 更改permision文件夹不文件

$config['upload_path'] = chmod('./assets/images/', 0755);
        $config['allowed_types'] = 'gif|jpg|png';
        $config['max_size'] = '100';
        $config['max_width']  = '600';
        $config['max_height']  = '600';
        $config['file_name']  = $id;

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

        if(!$this->upload->do_upload())
        {
            $error = array('error' => $this->upload->display_errors());                 
            redirect('', $error);
        }
        else
        {
            $config['upload_path'];
            redirect('');
        }

答案 1 :(得分:0)

$('#id :selected').prop('selected', false);