Hi to all,

I'm a JScript user, but this time I've a problem with someone else
code, written in VBScript. The problem is: using the script I join to
force the download of a .pdf file, works fine except with a certain pdf
file of 7 mb: with this very pdf, it results in a zero byte download.
The file is not corrupted and opens finely in Acrobat if I download it
the usual way. The problems arise only when downloaded via this -
usually well working - script. The application is not mine and I cannot
rewrite it in Jscript :-D. Any idea or suggestion? Thank you alot!!

J.

PS the fact that the file is bigger than usual can count?

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>

<%Response.Buffer = True%>
<%
On Error Resume Next
Dim strPath
strPath = CStr(Request.QueryString("file"))
'-- do some basic error checking for the QueryString
If strPath = "" Then
Response.Clear
Response.Write("Specificare il file.")
Response.End
ElseIf InStr(strPath, "..") > 0 Then
Response.Clear
Response.Write("Cartella non trovata.")
Response.End
ElseIf Len(strPath) > 1024 Then
Response.Clear
Response.Write("Path troppo lungo.")
Response.End
Else
Call DownloadFile(strPath)
End If

Private Sub DownloadFile(file)
'--declare variables
Dim strAbsFile
Dim strFileExtension
Dim objFSO
Dim objFile
Dim objStream
'-- set absolute file location
strAbsFile = Server.MapPath(file)
'-- create FSO object to check if file exists and get properties
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
'-- check to see if the file exists
If objFSO.FileExists(strAbsFile) Then
Set objFile = objFSO.GetFile(strAbsFile)
'-- first clear the response, and then set the appropriate
headers
Response.Clear
'-- the filename you give it will be the one that is shown
' to the users by default when they save
Response.AddHeader "Content-Disposition", "attachment; filename="
& objFile.Name
Response.AddHeader "Content-Length", objFile.Size
Response.ContentType = "application/octet-stream"
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
'-- set as binary
objStream.Type = 1
Response.CharSet = "UTF-8"
'-- load into the stream the file
objStream.LoadFromFile(strAbsFile)
'-- send the stream in the response
Response.BinaryWrite(objStream.Read)
objStream.Close
Set objStream = Nothing
Set objFile = Nothing
Else 'objFSO.FileExists(strAbsFile)
Response.Clear
Response.Write("File non esistente.")
End If
Set objFSO = Nothing
End Sub
%>