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

WBOY
Release: 2016-06-13 13:28:48
Original
805 people have browsed it

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);
       }      
    }

Copy after login

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

------解决方案--------------------
加上这个 $upload->allowExts = array("rar"); // 设置附件上传类型
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template