$resp[0]['origin_name'], "src" => $resp[0]['url'], ],200); } catch (\Throwable $throwable) { return error($throwable->getMessage()); } } /** * 上传文件 * @param Request $request * @return Response */ #[Route(path: "file",methods: "post")] public function upload2file(Request $request): Response { try { $resp = UploadExtend::disk(UploadExtend::MODE_LOCAL)->uploadFile(); if (!isset($resp[0]['url'])) return errorTrans(40010); return successTrans("success.data",[ "fileName" => $resp[0]['origin_name'], "src" => $resp[0]['url'], ],200); } catch (\Throwable $throwable) { echo $throwable->getFile()."\n"; echo $throwable->getLine()."\n"; return error($throwable->getMessage()); } } }