|
服务器使用的是winxp+apache+mysql 5搭建的环境
浏览器分别是ff和ie8
使用系统自带security类来上传文件时,无法上传.rar文件
我已经修改了allowed_types参数,其他文件类型都正常,但.rar就不行,提示文件类型不对。
我想知道这是不是我代码的问题,一下是我的上传过程代码。
PHP复制代码 function do_upload ()
{
$this->load->helper('security');
$config['upload_path'] = './uploads/';
$config['allowed_types'] =
'chm|rar|zip|gif|jpg|png|jpeg|doc|ppt|wps|xls|pdf|exe';
$config['max_size'] = '1024*10';
$config['max_width'] = '0';
$config['max_height'] = '0';
$randnum = strtolower(random_string ('alnum',5));
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload('up'))
{
$error = array('error'=>$this->upload->display_errors());
$this->load->view('upload_form', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());
$old = '././uploads/'.$data['upload_data']['file_name'];
$new = '././uploads/'.$randnum.'~'.$data['upload_data']
['file_name'];
$result_rename = file_rename ($old,$new);
$result_db = $this->upload_db->insert($randnum,$new);
$data['rand'] = $randnum;
$this->load->view('upload_success', $data);
}
} 复制代码
谢谢大家的帮助
|
|