Asp文件下载

Sub downTheFile(thePath)
Response.Clear
If isDebugMode = False Then
On Error Resume Next
End If
Dim stream, fileName, debugType

fileName = split(thePath,"")(uBound(split(thePath,"")))
Set stream = Server.CreateObject("adodb.stream")
stream.Open
stream.Type = 1
stream.LoadFromFile(thePath)
chkErr(Err)
Response.AddHeader "Content-Disposition", "attachment; filename=" & fileName
Response.AddHeader "Content-Length", stream.Size
Response.Charset = "UTF-8"
Response.ContentType = "application/octet-stream"
Response.BinaryWrite stream.Read
Response.Flush
stream.Close
Set stream = Nothing
End Sub
posted @ 2008-03-30 15:14  千年  阅读(315)  评论(0编辑  收藏  举报