首页 > 代码库 > 下载图片
下载图片
public ActionResult Download(string url) { Response.AddHeader("content-type", "application/application/x-msdownload"); Response.AddHeader("Content-Disposition", "attachment;filename=" + url.Split(‘/‘).Last()); HttpWebRequest request = (HttpWebRequest)WebRequest.Create(url); WebResponse response = request.GetResponse(); Stream resStream = response.GetResponseStream(); return File(resStream, response.ContentType); }
@Html.ActionLink("下载", "Download", new { url = "http://h.hiphotos.baidu.com/baike/s%3D220/sign=eb8c4e58a2cc7cd9fe2d33db09002104/d009b3de9c82d1588b9c0c04810a19d8bc3e426c.jpg" })
下载图片
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。