codice:
Response.Buffer = true
'percorso = "zip/"
percorso = "../../../../db/"
estensione="zip"
if Right (file1,3) = estensione then
ByteRicevuti = Request.TotalBytes
variabile = 0
if ByteRicevuti > 0 then
DatiRicevuti = Request.BinaryRead(ByteRicevuti)
For i = 1 To lenB(DatiRicevuti) 'lunghezza DatiRicevuti in binario
FileBinario = FileBinario & chr(ascB(midB(DatiRicevuti,i,1)))
Next
FirmaFile = left(FileBinario,instr(FileBinario,"" & vbCrLf)-1)
ArrPezzi = split(FileBinario,FirmaFile)
for item = 1 to ubound(ArrPezzi)-1
Inizio = instr(ArrPezzi(item),"" & vbCrLf & "" & vbCrLf)
Intestazione = left(ArrPezzi(item),Inizio-1)
Inizio = Inizio + len("" & vbCrLf) + len("" & vbCrLf)
ContenutoFile = mid(ArrPezzi(item),Inizio,len(ArrPezzi(i
tem))-Inizio-1)
' Recupero i campi se sono compilati
'if instr(Intestazione,"testo1") > 0 then
'testo1 = ContenutoFile
'end if
' Qui recupero il file da uploadare (se presente) e lo scrivo
' sul server
if instr(Intestazione,"file1") > 0 then
i = instr(Intestazione,"filename=")
j = instr(i + 10,Intestazione,chr(34))
NomeUpload = mid(Intestazione,i + 10,j-i-10)
i = instrRev(NomeUpload,"\")
if i<>0 then
NomeFile = mid(NomeUpload,i + 1)
else
NomeFile = NomeUpload
end if
if i<>0 then
Set FSO = CreateObject("Scripting.FileSystemObject")
Upload1 = True
DimensioneFile1 = len(ContenutoFile)
'pippo = DimensioneFile1*0.001
'If pippo >200000 Then
'Paginadidestinazione= "log.asp?post5&size="&pippo
'else
EstensioneFile1 = right(ContenutoFile,3)
NomeFile1 = NomeFile
response.write(percorso&NomeFile1)
Set textStream = FSO.CreateTextFile(server.mappath(percorso&NomeFile1), True, False)
textStream.Write ContenutoFile
'textStream.Write NomeFile1
textStream.Close
Set textStream = Nothing
Set FSO = Nothing
end if
end if
next
end if
else
response.write("Il file Inserito non è di un formato valido
")
response.write("Riprovare con un file .zip")
end if
prova