楼主: 冰河非非

[求代码] 批量下载多文件方法

[复制链接]
冰河非非 发表于 2021-12-19 21:01:47 | 显示全部楼层 |阅读模式
如题:批量下载多文件方法

For i = 1 to  10

文件地址:   Filename="../user/upload/"&rs(0)&"/"&rs(1)

            

Next

如何批量下载这些地址?
xuanxiao 发表于 2021-12-20 11:15:37 | 显示全部楼层

  1. *************************
  2. .....................
  3. while not rs.eof
  4. response.write "<a href=""download.asp?file=" & Server.UrlEncode(filename) & """>下载</a><br>"
  5. rs.movenext
  6. ..............................

  7. 下面是download.asp
  8. <%
  9. Dim  strFile


  10. strFile = Request.QueryString("file")

  11. If strFile <> "" Then

  12.     Response.Buffer = False
  13.     Dim objStream
  14.     Set objStream = Server.CreateObject("ADODB.Stream")
  15.     objStream.Type = 1 'adTypeBinary
  16.     objStream.Open
  17.     objStream.LoadFromFile("F:\ttasp" & strFile)
  18.     Response.ContentType = "application/x-unknown"
  19.     Response.Addheader "Content-Disposition", "attachment; filename=" & strFile
  20.     Response.BinaryWrite objStream.Read
  21.     objStream.Close
  22.     Set objStream = Nothing

  23. End If
  24. %>



复制代码


循环列出,用户就可以点击下载。
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表

在线客服

售前咨询
售后咨询
服务热线
023-58418553
微信公众号