Salve a tutti,
il mio problema è il seguente:
ho dei file PDF(in binario) all'interno di un database. Come posso creare e salvare il PDF sul mio computer?
Grazie in aticipo
Ciao
Salve a tutti,
il mio problema è il seguente:
ho dei file PDF(in binario) all'interno di un database. Come posso creare e salvare il PDF sul mio computer?
Grazie in aticipo
Ciao
Per ora ho trova questa funzione, il mio problema è che del mio PDF non ho il percorso(es. c:\cartella\FilePDF.pdf) ma è all'interno di una tabella. Quindo come posso fare?
Sub downloadFile(strFilename,saveas)
dim s,fso,f,intFilelength, binaryData
' pulisco il buffer
Response.Buffer = True
Response.Clear
' creo lo stream
Set s = Server.CreateObject("ADODB.Stream")
s.Open
' imposto il binario
s.Type = 1
' carico il file
on error resume next
' controllo se esiste il file
Set fso = Server.CreateObject("Scripting.FileSystemObject")
if not fso.FileExists(strFilename) then
Response.Write("<font style=""font-face : Verdana; font-size : 8pt"">Errore: il file " & strFilename & " non esiste.</font>")
Response.End
end if
' recupero la lunghezza del file
s.LoadFromFile(strFilename)
intFilelength = s.Size
if err then
Response.Write("<h1>Errore: </h1>" & err.Description & "
")
Response.End
end if
' Manda l'header al browser
if lcase(Right(saveas,3)) = "pdf" then
Response.AddHeader "Content-Disposition", "attachment;filename=" & saveas
else
Response.AddHeader "Content-Disposition", "filename=" & saveas
end if
Response.AddHeader "Content-Length", intFilelength
Response.CharSet = "UTF-8"
Response.ContentType = "application/save; name=" & saveas
Response.AddHeader "Pragma", "no-cache"
'response.write binaryData
binaryData = s.Read
' chiudo tutto
s.Close
Set s = Nothing
' scrivo sul browser il file
Response.BinaryWrite binaryData
Response.Flush
Response.End
End Sub
Nessuno sa dirmi se si può fare?