Originariamente inviato da Roby_72
Ora devi usare il download forzato via script oppure sempre tramite script "copiare" il file che ti serve in una cartella, scaricarlo e al termine cancellare la copia.
Roby
Grazie.
Per il download forzato utilizzo questo codice:
codice:
<%
Private Sub DownloadFile(file)
Dim strAbsFile
Dim strFileExtension
Dim objFSO
Dim objFile
Dim objStream
strAbsFile = Server.MapPath(file)
Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(strAbsFile) Then
Set objFile = objFSO.GetFile(strAbsFile)
Response.Clear
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
objStream.Type = 1
Response.CharSet = "UTF-8"
objStream.LoadFromFile(strAbsFile)
Response.BinaryWrite(objStream.Read)
objStream.Close
Set objStream = Nothing
Set objFile = Nothing
End If
Set objFSO = Nothing
End Sub
strPath = rs("Link")
Call DownloadFile(strPath)
%>
Mi dà errore sulla riga rossa:
Server.MapPath() error 'ASP 0173 : 80004005'
Invalid Path Character
/download.asp, line 11
An invalid character was specified in the Path parameter for the MapPath method.
Forse perchè in strPath = rs("Link") c'è un percorso virtuale e non fisico ?