MVC下载(存在文件的状况)
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"); }