codice:
if action = "upload" then
dim percorso, ByteRicevuti, DatiRicevuti, i, FileBinario, FirmaFile
dim ArrPezzi, item, Inizio, Intestazione, ContenutoFile, j
ByteRicevuti = Request.TotalBytes
if ByteRicevuti > 0 then
DatiRicevuti = Request.BinaryRead(ByteRicevuti)
For i = 1 To lenB(DatiRicevuti)
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(item))-Inizio-1)
percorso = session("cartella")
'-----------------------------------
' PRIMO FILE
'-----------------------------------
dim NomeUpload, NomeFile, FSO, Upload1, DimensioneFile1
dim EstensioneFile1, NomeFile1, textStream
' 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)
EstensioneFile1 = right(ContenutoFile,3)
NomeFile1 = NomeFile
Set textStream = FSO.CreateTextFile(server.mappath(percorso & "/" & NomeFile1), True, False)
textStream.Write ContenutoFile
textStream.Close
Set textStream = Nothing
Set FSO = Nothing
end if
end if
'-----------------------------------
' SECONDO FILE
'-----------------------------------
dim DimensioneFile2, EstensioneFile2, NomeFile2, Upload2
if instr(Intestazione,"file2") > 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")
Upload2 = True
DimensioneFile2 = len(ContenutoFile)
EstensioneFile2 = right(ContenutoFile,3)
NomeFile2 = NomeFile
Set textStream = FSO.CreateTextFile(server.mappath(percorso & "/" & NomeFile2), True, False)
textStream.Write ContenutoFile
textStream.Close
Set textStream = Nothing
Set FSO = Nothing
end if
end if
'-----------------------------------
' TERZO FILE
'-----------------------------------
dim DimensioneFile3, EstensioneFile3, NomeFile3, Upload3
if instr(Intestazione,"file3") > 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")
Upload3 = True
DimensioneFile3 = len(ContenutoFile)
EstensioneFile3 = right(ContenutoFile,3)
NomeFile3 = NomeFile
Set textStream = FSO.CreateTextFile(server.mappath(percorso & "/" & NomeFile3), True, False)
textStream.Write ContenutoFile
textStream.Close
Set textStream = Nothing
Set FSO = Nothing
end if
end if
'-----------------------------------
' QUARTO FILE
'-----------------------------------
dim DimensioneFile4, EstensioneFile4, NomeFile4, Upload4
if instr(Intestazione,"file4") > 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")
Upload4 = True
DimensioneFile4 = len(ContenutoFile)
EstensioneFile4 = right(ContenutoFile,3)
NomeFile4 = NomeFile
Set textStream = FSO.CreateTextFile(server.mappath(percorso & "/" & NomeFile4), True, False)
textStream.Write ContenutoFile
textStream.Close
Set textStream = Nothing
Set FSO = Nothing
end if
end if
'-----------------------------------
' QUINTO FILE
'-----------------------------------
dim DimensioneFile5, EstensioneFile5, NomeFile5, Upload5
if instr(Intestazione,"file5") > 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")
Upload5 = True
DimensioneFile5 = len(ContenutoFile)
EstensioneFile5 = right(ContenutoFile,3)
NomeFile4 = NomeFile
Set textStream = FSO.CreateTextFile(server.mappath(percorso & NomeFile5), True, False)
textStream.Write ContenutoFile
textStream.Close
Set textStream = Nothing
Set FSO = Nothing
end if
end if
next
Response.Write "<font color=red>Sono stati uploadati i seguenti file nella cartella " & percorso & ":
"
If Upload1 = true then
Response.Write "- " & NomeFile1 & "(" & DimensioneFile1*0.001 & "kb)"
End If
If Upload2 = true then
Response.Write "- " & NomeFile2 & "(" & DimensioneFile2*0.001 & "kb)"
End If
If Upload3 = true then
Response.Write "- " & NomeFile3 & "(" & DimensioneFile3*0.001 & "kb)"
End If
If Upload4 = true then
Response.Write "- " & NomeFile4 & "(" & DimensioneFile4*0.001 & "kb)"
End If
If Upload5 = true then
Response.Write "- " & NomeFile5 & "(" & DimensioneFile5*0.001 & "kb)"
End If
response.write "</font>"
End if
Se avete qualche idea....