yingzi 2 years ago
parent
commit
e955c1104c
1 changed files with 4 additions and 0 deletions
  1. 4 0
      app/system/controller/Upload.php

+ 4 - 0
app/system/controller/Upload.php

@@ -28,6 +28,10 @@ class Upload extends AuthController{
         if(empty($file)) {
             return app('json')->fail("未上传文件");
         }
+        $size = $file->getSize();
+        if(!empty($size) && $size>$uploadConfig["image"]["size"]*1024*1024){
+            return app('json')->fail("图片不能超过{$uploadConfig["image"]["size"]}M");
+        }
         if(!in_array($code, $uploadConfig['image']['path'])){
             return app('json')->fail("上传路径错误");
         }