I have a list of hyperlinks to files and would like to have the download box appear when user clicks on file links(of any type) instead of the files opening right away.
The following code fails at the loadfile command. It gives error 500. Can someone please help?
Thank you in advance,
Nima
<%@ Language=VBScript %>
<%
Dim filePath
Dim fileName
Dim FStream
'Set the file and path
fileName = request.querystring("f")
filePath = "http://authoring.tbs-sct.gc.ca/emis-sigd/download/" & fileName
'Response.write(filePath)
'Response.End
'Create the header information
Response.ContentType = "application/asp-unknown"
Response.AddHeader "content-disposition","attachment; filename=" & fileName
'Create and configure the object
Set FStream = Server.CreateObject("ADODB.Stream")
FStream.Open()
FStream.Type = 1
FStream.LoadFromFile(filePath)
'Stream it to the client
Response.BinaryWrite FStream.Read()
'Cleanup
FStream.Close
Set FStream = Nothing
'Force the end
Response.End
%>