ok sistemato
utilizzando codici che ho già scritto negli anni (per velocizzare il lavoro
) , non avevo fatto caso che forzando il download potevo rinominare il file
posto il codice..magari serve a qualcuno
codice:
<%@ Language=VBScript %>
<%
Response.Expires=0
Response.Buffer=0
Const CHUNK = 2048
strFilePath = Server.MapPath("/public/dati.txt")
Set fso = Server.CreateObject("Scripting.FileSystemObject")
' Controllo se esiste il file
if fso.FileExists(strFilePath) then
set objFile = fso.GetFile(strFilePath)
'Response.AddHeader "Content-Disposition", "attachment; filename=" & objFile.Name <- l'errore era qua
Response.AddHeader "Content-Disposition", "attachment; filename=dati.html" ' <- file con estensione modificata in fase di download
Response.AddHeader "Content-Length", objFile.Size
Response.ContentType = "application/octet-stream"
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1 ' adTypeBinary
objStream.LoadFromFile strFilePath
lSize = objStream.Size
lBlocks = 1
For lBlocks = lBlocks To lSize \ CHUNK
If Response.IsClientConnected = False Then Exit For
Response.BinaryWrite objStream.Read(CHUNK)
Next
lSize = lSize Mod CHUNK
If lSize > 0 And Response.IsClientConnected = True Then
Response.BinaryWrite objStream.Read(lSize)
End If
objStream.Close
Set objStream = Nothing
end if
%>
grazie