当前位置: 代码迷 >> VC/MFC >> MVC下载(存在文件的状况)
  详细解决方案

MVC下载(存在文件的状况)

热度:134   发布时间:2016-05-02 03:45:41.0
MVC下载(存在文件的情况)

前台:

<h1>下载</h1><button onclick="location = 'download'">下载</button>

后台:

 public ActionResult download()        {            return File(new FileStream(Server.MapPath("/upload/20150917145429221.png"), FileMode.Open), "application/octet-stream", "test.png");        }

 

  相关解决方案