Download files using Classic ASP
<%@ Language=VBScript %>
<%
Dim fn
Dim FPath
Dim adoStream
if(Request("f")=vbNullString) then
Response.Write "
File not found
"
Response.Write "
CLICK HERE TO CONTINUE"
else
fn=trim(Request("f"))
Response.ContentType = "application/x-msexcel" ' arbitrary
Response.AddHeader "Contents-Disposition","attachement;filename="& fn
FPath=Request.ServerVariables("APPL_PHYSICAL_PATH") & fn
Response.AddHeader "Content-Disposition","attachment; filename=" & fn
Set adoStream = CreateObject("ADODB.Stream")
adoStream.Open()
adoStream.Type = 1
adoStream.LoadFromFile(FPath)
Response.BinaryWrite adoStream.Read()
adoStream.Close
Set adoStream = Nothing
end if
%>
<%@ Language=VBScript %> <%
Dim fn
Dim FPath
Dim adoStream
if(Request("f")=vbNullString) then
Response.Write "
File not found
"
Response.Write "
CLICK HERE TO CONTINUE"
else
fn=trim(Request("f"))
Response.ContentType = "application/x-msexcel" ' arbitrary
Response.AddHeader "Contents-Disposition","attachement;filename="& fn
FPath=Request.ServerVariables("APPL_PHYSICAL_PATH") & fn
Response.AddHeader "Content-Disposition","attachment; filename=" & fn
Set adoStream = CreateObject("ADODB.Stream")
adoStream.Open()
adoStream.Type = 1
adoStream.LoadFromFile(FPath)
Response.BinaryWrite adoStream.Read()
adoStream.Close
Set adoStream = Nothing
end if
%>
<%@ Language=VBScript %> <%
Dim fn
Dim FPath
Dim adoStream
if(Request("f")=vbNullString) then
Response.Write "
File not found
"
Response.Write "
CLICK HERE TO CONTINUE"
else
fn=trim(Request("f"))
Response.ContentType = "application/x-msexcel" ' arbitrary
Response.AddHeader "Contents-Disposition","attachement;filename="& fn
FPath=Request.ServerVariables("APPL_PHYSICAL_PATH") & fn
Response.AddHeader "Content-Disposition","attachment; filename=" & fn
Set adoStream = CreateObject("ADODB.Stream")
adoStream.Open()
adoStream.Type = 1
adoStream.LoadFromFile(FPath)
Response.BinaryWrite adoStream.Read()
adoStream.Close
Set adoStream = Nothing
end if
%>
<%@ Language=VBScript %> <%
Dim fn
Dim FPath
Dim adoStream
if(Request("f")=vbNullString) then
Response.Write "
File not found
"
Response.Write "
CLICK HERE TO CONTINUE"
else
fn=trim(Request("f"))
Response.ContentType = "application/x-msexcel" ' arbitrary
Response.AddHeader "Contents-Disposition","attachement;filename="& fn
FPath=Request.ServerVariables("APPL_PHYSICAL_PATH") & fn
Response.AddHeader "Content-Disposition","attachment; filename=" & fn
Set adoStream = CreateObject("ADODB.Stream")
adoStream.Open()
adoStream.Type = 1
adoStream.LoadFromFile(FPath)
Response.BinaryWrite adoStream.Read()
adoStream.Close
Set adoStream = Nothing
end if
%>