application/manage/controller/Upload.php
public function upload(Request $request)
    {
        $type = $request->param('upload_type', '');
        
        // 文件
        $upload_file = isset($_FILES['upload_file']) ? $_FILES['upload_file'] : null;
        if (empty($upload_file)) {
            responseReturn(Format::formatResult(0, '上传文件不存在'));
        }
        
        // 额外配置
        $upload_option = $request->param('upload_option', '');
        if (! empty($upload_option)) {
            $upload_option = json_decode($upload_option, true);
        } else {
            $upload_option = [];
        }
        
        // 上传文件
        $upload_driver = FileLogic::instance()->getUploadDriver();
        $res = $upload_driver->upload($upload_file, $type, $upload_option);
        responseReturn($res);
    }
public function upload(Request $request)
    {
        $type = $request->param('upload_type', '');
        
        // 文件
        $upload_file = isset($_FILES['upload_file']) ? $_FILES['upload_file'] : null;
        if (empty($upload_file)) {
            responseReturn(Format::formatResult(0, '上传文件不存在'));
        }
        
        // 额外配置
        $upload_option = $request->param('upload_option', '');
        if (! empty($upload_option)) {
            $upload_option = json_decode($upload_option, true);
        } else {
            $upload_option = [];
        }
        
        // 上传文件
        $upload_driver = FileLogic::instance()->getUploadDriver();
        $res = $upload_driver->upload($upload_file, $type, $upload_option);
        responseReturn($res);
    }
public function upload ( Request $ request ) { $ type = $ request -> param ( 'upload_type' , '' ) ; // 文件 $ upload_file = isset ( $ _FILES [ 'upload_file' ] ) ? $ _FILES [ 'upload_file' ] : null ; if ( empty ( $ upload_file ) ) { responseReturn ( Format :: formatResult ( 0 , '上传文件不存在')); } // 额外配置 $ upload_option = $ request -> param ( 'upload_option' , '' ) ; if ( ! empty ( $ upload_option ) ) { $ upload_option = json_decode ( $ upload_option , true ) ; } else { $ upload_option = [ ] ; } // 上传文件 $ upload_driver = FileLogic :: instance ( ) -> getUploadDriver ( ) ; $ res = $ upload_driver -> upload ( $ upload_file , $ type , $ upload_option ) ; responseReturn ( $ res ) ; }
上传文件

@param Request $request
@throws \think\exception\HttpResponseException
上传文件