|
为啥配置上传文件类型限制了依然可以上传其他类型文件?
PHP复制代码
public function index_pic_add () {
$this->load->helper('form');
if(empty($_POST)){
$this->load->view('/admin/index_pic_add.php');
} else {
$dir = "./public/index_pic/".date("Ymd",time());
if(!is_dir($dir)){
mkdir($dir,'0777');
echo 'OK';
}
$config['upload_path'] = $dir;
$config['allowed_types'] = 'gif|png|jpg|jpeg';
$config['max_size'] = 2000;
$config['file_name'] = time().rand(100, 1000000);
$this->load->library('upload',$config);
$s = $this->upload->do_upload('file');//提交页面input框的name的名字
$fileinfo = $this->upload->data();
$data['pic_name'] = $fileinfo['file_name'];
$data['pic_url'] = $dir;
if($this->admin_model->list_add($table = 'index_pic',$data)){
$data['massage']='添加成功';
$data['url']= site_url ('admin/index_pic');
$data['time']= 3;
$this->load->view('/admin/massage.php',$data);
} else {
$data['massage']=$this->upload->display_errors();
$data['url']= site_url ('admin/index_pic');
$data['time']= 3;
$this->load->view('/admin/massage.php',$data);
}
}
}
复制代码
php txt依然可以上传
|
|