首页 新闻 会员 周边

快帮我看看为何不能下载图片。

0
[已关闭问题] 关闭于 2017-06-05 11:21
 if (pUploadData != null)
                {
                    //下载
                    //以字符流的形式下载文件                    
                    Response.ContentType = "application/octet-stream";

                    //获取浏览器类型
                    string strUserAgent = GTSoft.Web.Common.CommonFunction.GetString(Request.ServerVariables["http_user_agent"]);
                    if (strUserAgent.ToLower().IndexOf("firefox") == -1)
                    {//非火狐浏览器
                        Response.AddHeader("Content-Disposition", "attachment; filename=" +
                        HttpUtility.UrlEncode(strMediaName, System.Text.Encoding.UTF8));
                    }
                    else
                    {//火狐浏览器
                        Response.AddHeader("Content-Disposition", "attachment; filename=" + strMediaName);

                    }
                    Response.BinaryWrite(pUploadData);
                    Response.Flush();
                    Response.End();
                }
你猜丶的主页 你猜丶 | 初学一级 | 园豆:183
提问于:2017-06-05 11:16
< >
分享
所有回答(1)
0

 http://www.cnblogs.com/huage-1234/p/7346396.html这边有几个下载文件的方法,可以看看

华临天下 | 园豆:1501 (小虾三级) | 2017-11-21 19:37
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册