限制上传大小20M

This commit is contained in:
Dai 2025-05-14 19:36:39 +08:00
parent b163364831
commit fa5394ce81

View File

@ -25,10 +25,7 @@ class UploadService
$fileSize = $file->getSize();
if ($fileSize > 20 * 1024 * 1024){
return [
'code' => ResponseCode::FAIL,
'msg' => '图片超出20M',
];
throw new Exception('文件超出20M');
}
$uploadDir = '/files/' . $type . '/' . date('Ym') . '/';
@ -82,10 +79,7 @@ class UploadService
$fileSize = $file->getSize();
if ($fileSize > 20 * 1024 * 1024){
return [
'code' => ResponseCode::FAIL,
'msg' => '文件超出20M',
];
throw new Exception('文件超出20M');
}
$origin_name = $file->getUploadName();