作者 邓超

上传文件

... ... @@ -48,6 +48,40 @@ class Upload extends Base {
}
/**
* 上传文件
* @return array
* @throws \Lib\Err
* @author:dc
* @time 2025/1/16 10:26
*/
public function file(){
$files = app()->file('files');
$result = [];
if($files){
foreach ($files as $file){
$file->verify([
'ext' => [],
'size' => 1024*50,
'mine' => []
]);
if($file->move()){
$result[] = [
'name' => $file->name,
'saveName' => $file->saveName,
'saveUrl' => APP_HOST.$file->saveName
];
}
}
}
return $result;
}
... ...
... ... @@ -66,6 +66,8 @@ return [
// 上传图片
'upload/image' => [\Controller\Upload::class, 'image'],
// 上传文件
'upload/file' => [\Controller\Upload::class, 'file'],
// 解析 订阅url参数 数据
'desubscribe' => [\Controller\Home::class, 'desubscribe']
... ...