Ciao,
ho guardato tutti i codici che ho trovato sul Download ed alla fine ho preso quello di "optime". mi da errore nella riga: objStream.LoadFromFile strFilePath con l'errore: File could not be opened.
vi posto il codice:
Dove sbaglio? Inoltr devo salvare tutti i file senza distinzione di estensione.codice:<%@ Language=VBScript %> <HTML> <HEAD> <link rel=stylesheet href="style.css" type="text/css"> <TITLE>Centro Trascrizioni Stampa Braille e Ingrandita</TITLE> </HEAD> <BODY> DOWNLOAD FORZATO <% dim sDownload sDownload = Request.QueryString("do") if sDownload = "si" then Response.Buffer = True Dim strFilePath, strFileSize, strFileName Dim oFso, oFile 'application("PATH_CTB") = "c:\Inetpub\wwwroot\CTB_FILES\" 'sCodice = "SUNA40600001" PATH_FILE = application("PATH_CTB") & "SUNA40600001" 'sCodice strFilePath = PATH_FILE + "\" 'Response.Write (strFilePath) Set oFso = CreateObject("Scripting.FileSystemObject") Set oFile = oFso.GetFile(strFilePath+ "P2200055.JPG") Response.Write (oFso.GetFile(strFilePath+ "P2200055.JPG")) strFileName = "P2200055.JPG" strFileSize = CLNG(oFile.size) Set oFile = Nothing Set oFso = Nothing Const adTypeBinary = 1 'Response.Clear Set objStream = Server.CreateObject("ADODB.Stream") objStream.Open objStream.Type = adTypeBinary 'Response.End objStream.LoadFromFile strFilePath strFileType = lcase(Right(strFileName, 4)) Select Case strFileType 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.AddHeader "Content-Disposition", "attachment; filename=" & strFileName 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 else%> <a href ="AAA6.asp?do='si'">Download</a><% end if%> </BODY> </HTML>
Grazie mille![]()
![]()
![]()
![]()

Rispondi quotando
, grazie per la tua mail
