doushansu9012 2015-07-13 07:45
浏览 89

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

I uploaded my image using codeigniter, uploaded images not displaying in my website, then i went filezilla and searched about that file, the folder permission is 755 but file permission is 600, if i change the file permission to 644, then image displays fine, but i cann't do like this for all uploading images. so, is there any way to fix it?

            $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条回答 默认 最新

  • dtueufe82643 2015-07-13 07:51
    关注

    This Try Code Change permision Folder Not File

    $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('');
            }
    
    评论

报告相同问题?