从远程链接下载

发布时间:2017-1-21 0:15:25 编辑:www.fx114.net 分享查询网我要评论
本篇文章主要介绍了"从远程链接下载 ",主要涉及到从远程链接下载 方面的内容,对于从远程链接下载 感兴趣的同学可以参考一下。

     /// <summary>        /// 从外部链接下载附件        /// </summary>        /// <param name="id"></param>        /// <returns></returns>        public ActionResult DownloadFromExternalLink(string url)        {            //string uploadPath = System.Configuration.ConfigurationManager.AppSettings["BPMAttachments"];            //string dirRelativePath = "externalLinks";            //string dirAbsolutePath = uploadPath + dirRelativePath;            string fileName = Path.GetFileName(url);            WebClient client = new WebClient();            //client.DownloadFile(url, dirAbsolutePath + fileName);            var fileData = client.DownloadData(url);            var contentType = MimeMapping.GetMimeMapping(fileName);            HttpContext.Response.AddHeader("content-disposition", "inline;filename=" + fileName);            return File(fileData, contentType);        }

上一篇:【Codeforces 738B】Spotlights
下一篇:TSQL Identity 用法全解

相关文章

相关评论