Home  >  Article  >  Backend Development  >  thinkphp实现不了rar文件的上传,希望大家指点一下解决方案

thinkphp实现不了rar文件的上传,希望大家指点一下解决方案

WBOY
WBOYOriginal
2016-06-13 10:26:15804browse

thinkphp实现不了rar文件的上传,希望大家指点一下
thinkphp实现文件上传,rar格式的不能上传,pdf,jpg,xls文件可以上传

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->    public function upload(){       if(!empty($_FILES)){           echo 'ok';           dump($_FILES);           //如果有文件上传,上传附件            $this->_upload();                   }       else{           echo 'no';           dump($_FILES);       }          }

在提交rar格式文件后,判断提交的数据是空的即打印出“no”;
倘若是提交pdf,jpg,xls文件,则判断提交的数据是正常,并且上传成功的

------解决方案--------------------
加上这个 $upload->allowExts = array("rar"); // 设置附件上传类型
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn