How to obtain thinkphp3.2.3 upload file path

PHP中文网
Release: 2023-03-01 07:08:01
Original
3799 people have browsed it

thinkphp3.2.3 How to get the path of uploaded files:

First enter the code

//  导入excel
     public function upload(){       $upload = new \Think\Upload();// 实例化上传类
       $upload->maxSize   =     3145728 ;// 设置附件上传大小
       $upload->exts      =     array('xlsx','xls');// 设置附件上传类型
       $upload->rootPath  =      './Uploads/'; // 设置附件上传根目录
       $upload->savePath  =      ''; // 设置附件上传(子)目录
       // 上传文件
       $info   =   $upload->upload();       if(!$info) {// 上传错误提示错误信息
           $this->error($upload->getError());
       }else{// 上传成功 获取上传文件信息
           foreach($info as $file){               $FilePath = $file['savePath'].$file['savename'];
           }
           dump($FilePath);
       }
     }
Copy after login

The page output content
string(17) "57a9841cc3208.xls"
Just the file name

I want to get the path of this file as shown below

How to obtain thinkphp3.2.3 upload file path

ORZ, who can teach me

Reply content:

$upload->savePath 或 $upload->rootPath
Copy after login

How to obtain thinkphp3.2.3 upload file path

The above is the content of how to get the path of uploaded files in thinkphp3.2.3. For more related content, please pay attention to the PHP Chinese website (www.php.cn) !

Related articles:

How to get thinkphp3.2.3 upload file path

Thinkphp3.2.3 integrates phpqrcode to generate QR code sample code sharing

PHP implements uploading files without page refresh

Usage Html5 implements asynchronous file upload, supports cross-domain, and has upload progress bar

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