<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<%
option explicit
dim sFile, sRoot, sDir, sExt, objShell, objFSO, sMIME, objStream, strFilename, f, intFilelength
Response.Buffer = True
Response.Clear
sRoot = application("QRP_Data_Path")
sDir = Request("dir")
sFile = Request("file")
set objFSO = server.CreateObject("Scripting.FileSystemObject")
sExt = objFSO.GetExtensionName (sFile)
Set f = objFSO.GetFile(sRoot & sDir & sFile)
intFilelength = f.size
set f = nothing
set objFSO = nothing
Set objShell = Server.CreateObject("Wscript.Shell")
On Error Resume Next
sMIME = objShell.RegRead("HKEY_CLASSES_ROOT." & sExt & "Content Type")
On Error GoTo 0
if len(sMIME) = 0 then
sMIME = "application/octetstream"
end if
set objShell = nothing
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1
objStream.LoadFromFile sRoot & sDir & sFile
Response.AddHeader "Content-Disposition", "filename=" & sFile & ";"
Response.AddHeader "Content-Length", intFilelength
Response.CharSet = "UTF-8"
Response.ContentType = sMIME
Response.BinaryWrite objStream.Read
Response.Flush
objStream.Close
Set objStream = Nothing
%>