Browse Source

修改文件上传目录

zgg 3 days ago
parent
commit
ce1a661f1a

+ 4 - 4
application/admin/controller/File.php

@@ -10,9 +10,9 @@ class File extends Auth
         $file = request()->file('files');
         // 移动到框架应用根目录/uploads/ 目录下
         $info = $file->validate([ 'size'=>config('app.max_upload_file_size') ])
-            ->move(env('root_path') . 'public' . DIRECTORY_SEPARATOR . 'uploads'. DIRECTORY_SEPARATOR . 'files2');
+            ->move(env('root_path') . 'public' . DIRECTORY_SEPARATOR . 'uploads'. DIRECTORY_SEPARATOR . 'files3');
         if($info){
-            $img = '/uploads/files2/' . $info->getSaveName();
+            $img = '/uploads/files3/' . $info->getSaveName();
             $img = str_replace('\\', '/', $img);
 
             $path = config("app.app_host").$img;
@@ -26,9 +26,9 @@ class File extends Auth
         $file = request()->file('files');
         // 移动到框架应用根目录/uploads/ 目录下
         $info = $file->validate(config('app.max_upload_img'))
-            ->move(env('root_path') . 'public' . DIRECTORY_SEPARATOR . 'uploads'. DIRECTORY_SEPARATOR . 'files2');
+            ->move(env('root_path') . 'public' . DIRECTORY_SEPARATOR . 'uploads'. DIRECTORY_SEPARATOR . 'files3');
         if($info){
-            $img = '/uploads/files2/' . $info->getSaveName();
+            $img = '/uploads/files3/' . $info->getSaveName();
             $img = str_replace('\\', '/', $img);
 
             $path = config("app.app_host").$img;

+ 4 - 4
application/api/controller/v1/Upload.php

@@ -13,9 +13,9 @@ class Upload extends Controller
         $file = request()->file('uploadFile');
         // 移动到框架应用根目录/uploads/ 目录下
         $info = $file->validate([ 'size'=>config('app.max_upload_file_size') ])
-            ->move(env('root_path') . 'public' . DIRECTORY_SEPARATOR . 'uploads'. DIRECTORY_SEPARATOR . 'files2');
+            ->move(env('root_path') . 'public' . DIRECTORY_SEPARATOR . 'uploads'. DIRECTORY_SEPARATOR . 'files3');
         if($info){
-            $img = '/uploads/files2/' . $info->getSaveName();
+            $img = '/uploads/files3/' . $info->getSaveName();
             $img = str_replace('\\', '/', $img);
             HelpHander::success(['path' => config("app.app_host").$img]);
         }else{
@@ -29,9 +29,9 @@ class Upload extends Controller
         // 移动到框架应用根目录/uploads/ 目录下
         $config = config('max_upload_img');
         $info = $file->validate($config)
-            ->move(env('root_path') . 'public' . DIRECTORY_SEPARATOR . 'uploads'. DIRECTORY_SEPARATOR . 'files2');
+            ->move(env('root_path') . 'public' . DIRECTORY_SEPARATOR . 'uploads'. DIRECTORY_SEPARATOR . 'files3');
         if($info){
-            $img = '/uploads/files2/' . $info->getSaveName();
+            $img = '/uploads/files3/' . $info->getSaveName();
             $img = str_replace('\\', '/', $img);
 
             try{

+ 1 - 1
application/common/model/PhOrders.php

@@ -110,7 +110,7 @@ class PhOrders extends Base
         if (preg_match('/^data:image\/(\w+);base64,/', $base64_image_content, $result)) {
             $type = $result[1]; // 图片类型
             $filename = md5(time()."|".$base64_image_content.'|'.mt_rand(1000,9999));
-            $new_file = "uploads/phsign/".$filename."." . $type;
+            $new_file = "uploads/phsign2/".$filename."." . $type;
             if (file_put_contents($new_file, base64_decode(str_replace($result[0], '', $base64_image_content)))) {
 //                return new \think\File($new_file, md5_file($new_file) . '.' . $type);
                 return config("app.app_host").'/'.$new_file;