public function uploadMore(){
// 获取表单上传文件 前端以imglist[]字段上传
$files = request()->file();
//上传失败验证
if(!$files){
TApiException('上传失败',20009,200);
}
try {
//文件验证,如果上传其它exe后缀文件,比如图标竟然验证通过??
$res=validate(['imglist'=>'fileSize:102400|fileExt:jpg,png])
->check($files);
foreach($files as $file) {
$savename[] = \think\facade\Filesystem::disk('public')->putFile( 'topic', $file);
}
return $savename;
} catch (\think\exception\ValidateException $e) {
TApiException($e->getMessage(),20009,200);//抛出异常
}
}
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号