questo è lo script che uso....cosa è che non va?
codice:
<%
'Questa variabile setta il percorso di dove effettuare l'upolad
'la cartella non puo non esistere lo script non la crea ! ! !
percorso = "/public/file/"
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)
' Recupero i campi se sono compilati
if instr(Intestazione,"categoria") > 0 then
categoria = ContenutoFile
categoria = Replace(categoria,"'","''")
end if
if instr(Intestazione,"nome") > 0 then
nome = ContenutoFile
nome = Replace(nome,"'","''")
end if
if instr(Intestazione,"descrizione") > 0 then
descrizione = ContenutoFile
descrizione = Replace(descrizione,"'","''")
end if
' Qui recupero il file da uploadare (se presente) e lo scrivo
' sul server
if instr(Intestazione,"file") > 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
next
End if
path = NomeFile1
path = Replace(path,"'","''")
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "DRIVER={Microsoft Access Driver (*.mdb)};" &_
"DBQ="& Server.MapPath("/mdb-database/auriga.mdb")
sql = "INSERT INTO download ([Categoria], [Nome], [Descrizione], [Path]) VALUES('" & categoria & "', '" & nome & "', '" & descrizione & "', '" & path & "')"
Conn.Execute(sql)
conn.close
set conn = nothing
response.Write("File inserito")