我想将文件夹(big_pics)的权限更改为模式777。
function do_upload(){
$config['upload_path'] = './big_pics/';
$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('')){
$error = array('error' => $this->upload->display_errors());
foreach($error as $key => $value){
echo $value."<br>";
}
//$this->load->view('upload_form', $error);
}else{
echo "Well DOne";
$data = array('upload_data' => $this->upload->data());
$this->load->view('upload_success', $data);
}
}
该文件夹位于根文件夹中。 我为这个项目使用codeigniter
答案 0 :(得分:0)
您可以在上传前使用此权限更改文件或文件夹的权限。
$frdata = array('upload_data' => $this->upload->data()); // get data
$frfile = $frdata ['upload_data']['full_path']; // get file path
chmod($frfile, 0777); // CHMOD file
if(!$this->upload->do_upload('file')) {
echo $this->upload->display_errors();
} else {
$file_name = $this->upload->data();
}