Blogger Information
Blog 8
fans 0
comment 1
visits 10297
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
thinkphp5.0利用第三方upload类上传文件
Moments的博客
Original
1135 people have browsed it
  1. 下载upload类,将解压后extend文件夹里的文件复制到thinkphp框架的extend文件夹里;

  2. 具体代码如下:


    Loader::import('org.upload.driver.Local.php'); //引入扩展upload类

    Loader::import('org.Upload.php');

    $config = [                                            //设置上传参数

           'maxSize'      => 3145728,

            'exts'         => ['imsclt'],

            'autoSub'      => false,

            'subName'      => ['date', 'Y-m-d'],

            'rootPath'     => './uploads/',

            'savePath'     => '',

            'saveName'     => time().'_'.mt_rand(),

            'replace'      => true,

            'saveExt'      => 'imsclt',

            'hash'         => true,

            'callback'     => true,

            'driver'       => 'Local',

        ];

        $upload=new Upload($config);   

         $info=$upload->upload();

        if(!$info)

        {

            echo $upload->getError();

        }

        else

        {

            echo 'success';

        }  

Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post