返回格式,可以根据自己的需求重新写
<?php
namespace app\api\controller;
use org\Upload;
class Uploader
{
public function uploader($fileName='wangEditorH5File'){
$config = [
'maxSize' => 2048000,
'exts' => ['jpg','gif','png','jpeg'],
'autoSub' => true,
'subName' => ['date', 'Y-m-d'],
'rootPath' => './data/',
'savePath' => 'attachement/',
'saveExt' => 'jpg',
'hash' => true,
'callback' => true,
'driver' => 'Local',
];
$uploader = new Upload($config);
$info = $uploader->upload();
if(!$info){
echo $uploader->getError();
}else{
header("Content-type:image/jpeg");
echo '/data/'.$info[$fileName]['savepath'].$info[$fileName]['savename'];
}
}
}扩展类放置位置 rootpath
|-extend
| |-com
| | |- ...
| |-org
| | |- ... 最佳答案