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);//抛出异常
}
}
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!