我使用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('');
}
此尝试代码更改权限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('');
}
$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;
$uploadata = array('upload_data' => $this->upload->data());
$perfile = $uploadata ['upload_data']['full_path'];
chmod($perfile ,0777)