From bf5c9b4b9ec380fd6935eb144a4c3f564acaa961 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=BD=87=E9=98=B3=20=E9=82=B9?= Date: Sat, 23 Dec 2023 14:31:02 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AA=E4=B8=8B?= =?UTF-8?q?=E8=BD=BD=E6=96=87=E4=BB=B6=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 24Hour/Controllers/Common/CommonController.cs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/24Hour/Controllers/Common/CommonController.cs b/24Hour/Controllers/Common/CommonController.cs index 6dee0d6..5da3584 100644 --- a/24Hour/Controllers/Common/CommonController.cs +++ b/24Hour/Controllers/Common/CommonController.cs @@ -2739,7 +2739,18 @@ namespace _24Hour.Controllers.Common #endregion #region 文件上传 + [HttpPost] + [Route("RequestDownloadFile")] + public IActionResult RequestDownloadFile(string filename) //[FromBody] dynamic Json + { + + var FileName = System.IO.Path.GetFileName(filename); + var currentDate = DateTime.Now; + var FilePath = filename; + + return new FileStreamResult(new FileStream(FilePath, FileMode.Open), "application/octet-stream") { FileDownloadName = FileName }; + } private string[] AllowedExtensions = new string[] { ".png", ".jpg", ".jpeg", ".bmp",".xlsx",".aks"}; /// /// 文件上传--附件