| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 | 
							- <?php
 
- namespace app\h5\controller;
 
- use think\captcha\Captcha;
 
- use think\Controller;
 
- use app\hander\HelpHander;
 
- class File extends Controller
 
- {
 
-     public function upfile(){
 
-         $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 . 'files');
 
-         if($info){
 
-             $img = '/uploads/files/' . $info->getSaveName();
 
-             $img = str_replace('\\', '/', $img);
 
-             $path = config("app.app_host").$img;
 
-             HelpHander::success(['path' => $path]);
 
-         }else{
 
-             HelpHander::error($file->getError());
 
-         }
 
-     }
 
-     public function upimg(){
 
-         $file = request()->file('files');
 
-         // 移动到框架应用根目录/uploads/ 目录下
 
-         $info = $file->validate(config('app.max_upload_img'))
 
-             ->move(env('root_path') . 'public' . DIRECTORY_SEPARATOR . 'uploads'. DIRECTORY_SEPARATOR . 'files');
 
-         if($info){
 
-             $img = '/uploads/files/' . $info->getSaveName();
 
-             $img = str_replace('\\', '/', $img);
 
-             $path = config("app.app_host").$img;
 
-             HelpHander::success(['path' => $path]);
 
-         }else{
 
-             HelpHander::error($file->getError());
 
-         }
 
-     }
 
- }
 
 
  |