yingzi há 2 anos atrás
pai
commit
061a57661f
1 ficheiros alterados com 3 adições e 3 exclusões
  1. 3 3
      app/api/controller/User.php

+ 3 - 3
app/api/controller/User.php

@@ -800,12 +800,12 @@ class User extends BaseController
         $filePath = $rootPath. DIRECTORY_SEPARATOR .$hashName;
         $path = dirname($filePath);
         // 检测目录
-        if (!is_dir($path)) {
-            return ["code"=>-1,"msg"=>"上传目录不存在"];
-        }
         if (!mkdir($path, 0777, true)) {
             return ["code"=>-1,"msg"=>"生成目录失败"];
         }
+        if (!is_dir($path)) {
+            return ["code"=>-1,"msg"=>"上传目录不存在"];
+        }
         //重名文件验证
         if (is_file($filePath)) {
             return ["code"=>-1,"msg"=>"文件已存在"];