日期:2014-05-17  浏览次数:20848 次

asp在线管理文件管理.把该文件夹下的文件下载下来,如asp、aspx
请教一下:如果我可以在线管理一个文件夹,如何把该文件夹下的文件下载下来,如asp、aspx

------解决方案--------------------
Sub DownTheFile()
Response.Clear
Dim stream, strPath, fileContentType
On Error Resume Next
strPath = "你的文件位置 "
Set stream = Server.CreateObject( "adodb.stream ")
stream.Open
stream.Type = 1
stream.LoadFromFile(strPath)
Response.AddHeader "Content-Disposition ", "Attachment; 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