- //文件上传
- public function files(){
- if(!emptyempty($_POST)){
- $data['remark'] = $this->_post('remark');
- import('ORG.Net.UploadFile');
- $upload = new UploadFile();
- $upload->savePath = './Public/uploads/files/';
- $upload->saveRule = '';
- if(!$upload->upload()) {
- $this->error($upload->getErrorMsg());
- }else{
- $info = $upload->getUploadFileInfo();
- }
- foreach ($info as $key => $val) {
- $data['title']=$val['savename'];
- $data['type']=$val['type'];
- $data['size']=$val['size'];
- $data['url']=$val['savepath'];
- }
- $data['addtime']=time();
- $data['aid']=$_SESSION['admin_info']['user_id'];
- $list=M("upload_files")->add($data);
- if($list){
- $this->success("文件上传成功!",U('Upload/fileslist'));
- }else{
- $this->error("文件上传失败!");
- }
- }else{
- $this->display();
- }
- }
新闻热点
疑难解答
图片精选