随风逐流 发表于 2013-10-17 14:03:01

请教下高手--ci文件上传doc文件为什么获取不到信息

                $format      = array('doc','docx','wps','gif','png','jpg'); //限定上传格式
                $category      = trim($this->input->post('category'));    //类别名称
                $contest_name= trim($this->input->post('contest_name')); //赛项名称
                $type          = trim($this->input->post('type'));             //组别
                $typenext      = trim($this->input->post('typenext'));    //组别子类
                $begin         = trim($this->input->post('begin_time'));//开始时间
                $end         = trim($this->input->post('end_time'));         //结束时间
                $content       = trim($this->input->post('content'));   //内容
                $form          = $_FILES['myform'];      //申报表格
                $filename      = substr(strrchr($form['name'],"."),1); //获取文件的后缀名比如png
                if(!in_array(strtolower($filename),$format)){                       //判断后缀名
                        echo "<font color='red'>上传文件格式不正确,请重新上传</font>";
                }elseif($form['size']>=2000000){
                        echo "<font color='red'>上传大小超出2M</font>";
                }else{
                        if(!empty($category) && !empty($contest_name)){   
                                $newname = $category.$contest_name.'.'.$filename;//组合成类别名+赛项名
                                $uri = ROOT_PATH.'uploadfile/file/'.date('Y').'/'.date('m-d').'/';
                                $upfile = $uri.$newname;
                                if(!is_dir($uri)){
                                   mkdir($uri,0777, TRUE);   //如果没有文件夹就创建
                          }       
                                $config['allowed_types']   = 'gif|jpg|png|docx|doc|wps';    //这里配置了doc docx 文件格式 可是上传这些文件就是不行,图片是可以的.
                                $config['upload_path']   = $uri;               
                                $config['file_name']       = date("Ymd His").$newname;
                                $config['max_size']      = '2048';
                                $this->load->library('upload', $config);
                                if($this->upload->do_upload('myform')){
                                        $arr = array('upload_data' => $this->upload->data());
                                        var_dump($arr);
                                }else{
                                           $arr['error'] = array('error' => $this->upload->display_errors());
                                        var_dump($arr['error']);
                                }
                        }
                }

随风逐流 发表于 2013-10-17 14:37:03

C:\Users\Administrator.ZGC-20130411LUF\Desktop\QQ截图20131017143611.png

随风逐流 发表于 2013-10-17 14:38:28

这是提交docx格式的

随风逐流 发表于 2013-10-17 14:39:24

这是上传图片类型的~

dren_a 发表于 2013-10-18 17:45:13

建议使用zip
页: [1]
查看完整版本: 请教下高手--ci文件上传doc文件为什么获取不到信息