1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
<%
Response.ContentType = "application/mdb"
Response.AddHeader "Content-Transfer-Encoding", "binary;"
Response.AddHeader "Content-Disposition", "attachment; filename=backup.mdb;"
thepath = server.mappath("/") & "\backup\backup.mdb"
'SOLUTION 1
set fsob = Server.CreateObject("Scripting.FileSystemObject")
set thefile = fsob.OpentextFile(thepath)
response.BinaryWrite(thefile.ReadAll)
'SOLUTION 2
Set fsob = Server.CreateObject("Scripting.FileSystemObject")
set thefile = fsob.getfile(thepath)
Set ts = thefile.OpenAsTextStream(1,-1)
response.BinaryWrite(ts.ReadAll)
ts.close
set ts = Nothing
set fsob = Nothing
set thefile = Nothing
%> |
Partager