我想强制用户下载文件。我的网站文件夹路径是D:\websites\domain\
,文件路径是E:\folder\file.bak
,
ASP - VBScript
<%
Dim Stream
Dim Contents
Dim FileName
FileName = "E:\db\A101.bak"
Response.ContentType = "application/octet-stream"
Response.AddHeader "content-disposition", "attachment; filename=" & FileName
Set Stream = server.CreateObject("ADODB.Stream")
Stream.Open
Stream.LoadFromFile Server.MapPath(FileName)
Contents = Stream.ReadText
Response.BinaryWrite Contents
Stream.Close
Set Stream = Nothing
%>
如果文件在我的网站文件夹中,它工作得很好,但是如果我使用路径 E:\db\A101.bak 给我一个错误, File not Found
. 由于安全原因,我无法在网站文件夹中移动文件。帮我