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); } }
The page output content
string(17) "57a9841cc3208.xls"
Just the file name
I want to get the path of this file as shown below
ORZ, who can teach me
Reply content:
$upload->savePath 或 $upload->rootPath
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