Google
      
发新话题
打印

XMLHTTP下载远程数据输出到浏览器

XMLHTTP下载远程数据输出到浏览器

  利用xmlhttp对象获取远程的数据,然后用二进制输出到客户浏览器,让客户下载数据,此例从某一远程服务器获取一个压缩包,并且输出到浏览器提供客户下载.

 程序代码:
 <%
 Response.Buffer = True
 Dim objXMLHTTP, xml
 Set xml = Server.CreateObject("Microsoft.XMLHTTP") '创建对象

 xml.Open "GET","http://www.afoer.com/pres.zip",False '  '设置对象,具体xmlhttp详细使用方法请见《XMLHTTP对象及其方法》一文



伊图教程网[www.etoow.com]
http://www.etoow.com/html/2007-08/1186287241.html
 xml.Send '发送请求

 Response.AddHeader "Content-Disposition", "attachment;filename=mitchell-pres.zip" '添加头给这个文件

 Response.ContentType = "application/zip" '设置输出类型

 Response.BinaryWrite xml.responseBody ’输出二进制到浏览器

 Set xml = Nothing
 %>

TOP

发新话题