asp设置文件下载

<%
‘asp读取1.swf这个文件,并提供下载,可以让用户无法获知下载文件的实际地址。
Response.Buffer = True
Dim objXMLHTTP, xml
Set xml = Server.CreateObject(“Microsoft.XMLHTTP”) ‘创建对象

xml.Open “GET”,”http://www.itlearner.com/1.swf”,False ‘
‘设置对象,具体xmlhttp详细使用方法请见:《XMLHTTP 对象及其方法》一文

xml.Send ‘发送请求

Response.AddHeader “Content-Disposition”, “attachment;filename=banner_k_050202.swf” ‘添加头给这个文件

Response.ContentType = “application/zip” ‘设置输出类型

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

Set xml = Nothing
%>

Popularity: 5%

No Responses to “asp设置文件下载”

Leave a Reply:

Name (required):
Mail (will not be published) (required):
Website:
Comment (required):
XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>