C# Mvc中文件下载

        public ActionResult DownloadFile(string id)
{
var fileinfo = CommonAnnexService.Get(id);
if (fileinfo.StatusValue == (long)PublicStatusEnum.正常)
{
if (System.IO.File.Exists(Server.MapPath(fileinfo.SavePath)))
{
return File(Server.MapPath(fileinfo.SavePath), "application/octet-stream", fileinfo.AnnexName +"."+ fileinfo.AnnexType);
}
return Fail("该文件已丢失");
}
return Fail("该文件已被删除");
}

  

上一篇:Oracle警告、跟踪文件(10046、死锁等跟踪)


下一篇:flask请求上下文源码分析