修改附件下载方法

development
温天培 1 year ago
parent efbc1a1910
commit 51872e047a

@ -60,7 +60,7 @@ namespace GDZZ.Application
var annexfile = await this._rep.FirstOrDefaultAsync(x => x.Id == input.Id);
if (annexfile == null)
throw Oops.Oh("文件为空,下载失败");
var filePath = Path.Combine(this._options.Default.path, annexfile.FileUrl, annexfile.FileName);
var filePath = Path.Combine(App.WebHostEnvironment.WebRootPath, annexfile.FileUrl, annexfile.Id+".pdf");
var fileName = HttpUtility.UrlEncode(annexfile.FileName, Encoding.GetEncoding("UTF-8"));
var result = new FileStreamResult(new FileStream(filePath, FileMode.Open), "application/octet-stream") { FileDownloadName = fileName };
return result;

Loading…
Cancel
Save