|
- <?php
- function upload(){
-
- $upload = new \Think\Upload();// 实例化上传类
- $upload->maxSize = 3145728 ;// 设置附件上传大小
- $upload->exts = array('xls', 'xlsx');// 设置附件上传类型
- $upload->rootPath='./Public/';
- $upload->savePath = './Uploads/'; // 设置附件上传目录
- // 上传单个文件
- $info = $upload->uploadOne($_FILES['importFile']);
- if(!$info) {
- $return=array(0,$upload->getError());
-
- }else {
- $path='./Public/'.$info['savepath'].$info['savename'];
- $return=array(1,$path);
- }
- return $return;
- }
|