From 6922ceb192bfcb15f840409bb5f0707d3ee448e9 Mon Sep 17 00:00:00 2001 From: Ben Lin <maobin001@msn.com> Date: 星期五, 21 六月 2024 18:09:57 +0800 Subject: [PATCH] 菜单权限更新 --- Tiger.Api/Controllers/Base/BaseController.cs | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-) diff --git a/Tiger.Api/Controllers/Base/BaseController.cs b/Tiger.Api/Controllers/Base/BaseController.cs index 0bc7ab8..1004fa4 100644 --- a/Tiger.Api/Controllers/Base/BaseController.cs +++ b/Tiger.Api/Controllers/Base/BaseController.cs @@ -10,6 +10,7 @@ using Newtonsoft.Json; using Tiger.IBusiness; using Tiger.Api.iBiz; +using System.IO; namespace Tiger.Api.Controllers.Base { @@ -530,5 +531,29 @@ return Ok(response); } #endregion + + #region 鏂囦欢涓婁紶 + /// <summary> + /// 鏂囦欢涓婁紶 + /// </summary> + /// <param name="file"></param> + /// <returns></returns> + [HttpPost] + public async Task<IActionResult> Upload(IFormFile file) + { + if (file == null || file.Length == 0) + return BadRequest("No file uploaded."); + + var path = Path.Combine($@"{BizConfig.Configuration["UploadAddress"]}", "upload", file.FileName); + + using (var stream = new FileStream(path, FileMode.Create)) + { + await file.CopyToAsync(stream); + } + + return Ok(new { file.FileName, file.ContentType, file.Length, url= $@"{BizConfig.Configuration["DownloadAddress"]}/"+ file.FileName }); + } + + #endregion } } \ No newline at end of file -- Gitblit v1.9.3