日期:2014-05-17 浏览次数:20398 次
<a href="文件的具体地址">点击下载</a>
------解决方案--------------------
只能打包下载,B/S好多人都在问能不能批量下载;至今都没好的解决方案。
------解决方案--------------------
nP += "<a href=指定下载页面.aspx?path="+finfo[i].FullName+">"+finfo[i].Name+"</a>"+"<br>"; 然后在下载页面的 pageload中写代码如下 string filePath =Request["path"];//通过URL传过来的参数 FileInfo fileInfo = new FileInfo(filePath); Response.Clear(); Response.ClearContent(); Response.ClearHeaders(); Response.AddHeader("Content-Disposition", "attachment;filename=" + fileName); Response.AddHeader("Content-Length", fileInfo.Length.ToString()); Response.AddHeader("Content-Transfer-Encoding", "binary"); Response.ContentType = "application/octet-stream"; Response.ContentEncoding = System.Text.Encoding.GetEncoding("gb2312"); Response.WriteFile(fileInfo.FullName); Response.Flush(); Response.End();