ciao a tutti, utilizzo il seguente script per il download forzato. Tutto ok ma quando provo scaricare file oltre 3-4Mb la pagina inizia a cariare all'infinito e non parte mai la finestra del download. com posso risolvere. Grazie.
<%
Response.Buffer = True
Set Fso = Server.CreateObject("Scripting.FileSystemObject")
Set f=fso.getfile(Server.MapPath("/mdb-database/" & Request.QueryString ("nome_cartella") & "/" & Request.QueryString("nome_file")))
strFileSize=f.size
adTypeBinary=1
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open()
objStream.Type = adTypeBinary
objStream.LoadFromFile(Server.MapPath("/mdb-database/" & Request.QueryString ("nome_cartella") & "/" & Request.QueryString("nome_file")))
nomefile = request.querystring ("nome_file")
tipologia = lcase(Right(nomefile, 4))
Select Case tipologia
Case ".asf"
ContentType = "video/x-ms-asf"
Case ".avi"
ContentType = "video/avi"
Case ".doc"
ContentType = "application/msword"
Case ".zip"
ContentType = "application/zip"
ContentType = "application/x-zip-compressed"
Case ".xls"
ContentType = "application/vnd.ms-excel"
Case ".gif"
ContentType = "image/gif"
Case ".jpg", "jpeg"
ContentType = "image/jpeg"
Case ".wav"
ContentType = "audio/wav"
Case ".mp3"
ContentType = "audio/mpeg3"
Case ".mpg", "mpeg"
ContentType = "video/mpeg"
Case ".rtf"
ContentType = "application/rtf"
Case ".htm", "html"
ContentType = "text/html"
Case ".asp"
ContentType = "text/asp"
Case Else
'Handle All Other Files
ContentType = "application/octet-stream"
End Select
Response.ContentType = ContentType
Response.AddHeader "Content-Disposition", "attachment; filename=" & nomefile
Response.AddHeader "Content-Length", strFileSize
Response.Charset = "UTF-8"
Response.ContentType = ContentType
Do While Not objStream.EOS
Response.BinaryWrite objStream.Read(1024)
Response.Flush
Loop
objStream.Close()
Set objStream = Nothing
%>

Rispondi quotando