1:this.Accessories.InnerHtml = "<a href=\"#\" onclick=\"javacript:FileDownload('" + ntmbulletin.FileUpload + "')\">" + ntmbulletin.FileUpload + "</a>";2:function FileDownload(filename)
{
PageService.FileDown(filename,TrueOrFalse,OnFailded);
}3: [WebMethod(EnableSession = true)]
public bool FileDown(string fileName)
{
string serFile = HttpContext.Current.Server.MapPath("~/FileUpload/") + fileName; // 服务器上存放文件的地址
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("Content-Type", "text/plain");
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName);
HttpContext.Current.Response.WriteFile(serFile); // 将文件以流的形式传输
HttpContext.Current.Response.End();
return true;
}
出错???????????????????????????????????????????????????????????????????????????????????????????????????????????
{
PageService.FileDown(filename,TrueOrFalse,OnFailded);
}3: [WebMethod(EnableSession = true)]
public bool FileDown(string fileName)
{
string serFile = HttpContext.Current.Server.MapPath("~/FileUpload/") + fileName; // 服务器上存放文件的地址
HttpContext.Current.Response.Clear();
HttpContext.Current.Response.AddHeader("Content-Type", "text/plain");
HttpContext.Current.Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName);
HttpContext.Current.Response.WriteFile(serFile); // 将文件以流的形式传输
HttpContext.Current.Response.End();
return true;
}
出错???????????????????????????????????????????????????????????????????????????????????????????????????????????
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货