| 12345678910111213141516171819202122232425262728293031323334353637383940414243 | <?phpnamespace app\admin\controller;use app\hander\HelpHander;class File extends Auth{    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 . 'files2');        if($info){            $img = '/uploads/files2/' . $info->getSaveName();            $img = str_replace('\\', '/', $img);            $path = request()->domain(true).$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 . 'files2');        if($info){            $img = '/uploads/files2/' . $info->getSaveName();            $img = str_replace('\\', '/', $img);            $path = request()->domain(true).$img;            HelpHander::success(['path' => $path]);        }else{            HelpHander::error($file->getError());        }    }}
 |