Ciao a tutti.
Utilizzo il codice di Baol per l'uplaod di files sul server.
Il form di invio è questo:
Come si può vedere ad ogni input type="file" corrisponde un input type="text" chiamato "Nota".codice:<form action="?upload=1" method="POST" ENCTYPE="multipart/form-data"> <input type="file" name="File1" size="35"> <input type="file" name="File2" size="35"> <input type="file" name="File3" size="35"> <input type="file" name="File4" size="35"> <input type="file" name="File5" size="35"> <input type="text" name="Nota_1" size="25"> <input type="text" name="Nota_2" size="25"> <input type="text" name="Nota_3" size="25"> <input type="text" name="Nota_4" size="25"> <input type="text" name="Nota_5" size="25"> </form>
Succede che quando recupero i dati dal form se uno degli input type="file" non contiene nulla, quindi nessun file da uploadare, lo script va in errore generico error '80020009' sulla riga che nel codice è segnata in rosso.
Sapreste aiutarmi a risolvere questo problema?
codice:If Request("Upload") = "1" then Dim oUpload Set oUpload= new cUpload With oUpload .EnabledAspUpload = False .EnabledLog = False .AutoRename = True .Overwrite = False .SetPath "ticket\" .Load if oUpload.Form("NOTA_2") <> "" then strNOTA_2 = oUpload.Form("NOTA_2") else strNOTA_2 = "-" end if if oUpload.Form("NOTA_3") <> "" then strNOTA_3 = oUpload.Form("NOTA_3") else strNOTA_3 = "-" end if if oUpload.Form("NOTA_4") <> "" then strNOTA_4 = oUpload.Form("NOTA_4") else strNOTA_4 = "-" end if if oUpload.Form("NOTA_5") <> "" then strNOTA_5 = oUpload.Form("NOTA_5") else strNOTA_5 = "-" end if strNOTA = oUpload.Form("NOTA_1") & ";" & strNOTA_2 & ";" & strNOTA_3 & ";" & strNOTA_4 & ";" & strNOTA_5 While Not .Eof arrNota = Split(strNOTA, ";") for i = LBound(arrNota) to UBound(arrNota) if oUpload.Form("File1") <> "" then file_uploaded = replace(oUpload.files("name"), "'", "''") & "." & oUpload.files("ext") elseif oUpload.Form("File2") <> "" then file_uploaded = replace(oUpload.files("name"), "'", "''") & "." & oUpload.files("ext") elseif oUpload.Form("File3") <> "" then file_uploaded = replace(oUpload.files("name"), "'", "''") & "." & oUpload.files("ext") elseif oUpload.Form("File4") <> "" then file_uploaded = replace(oUpload.files("name"), "'", "''") & "." & oUpload.files("ext") elseif oUpload.Form("File5") <> "" then file_uploaded = replace(oUpload.files("name"), "'", "''") & "." & oUpload.files("ext") else file_uploaded = "Nessuno" end if .Save strSQL = " INSERT INTO " strSql = strSql & " tabella " strSql = strSql & " ( " strSql = strSql & " PERCORSO_FILE, " strSql = strSql & " NOTE " strSql = strSql & " ) " strSql = strSql & " VALUES " strSql = strSql & " ( " strSql = strSql & " 'http://www.mywebpage.com/public/files/"& file_uploaded &"', " strSql = strSql & " '" & arrNota(i) & "' " strSql = strSql & " ) " cn.execute strSql .MoveNext next Wend End With Set oUpload = Nothing end if

Rispondi quotando