Visualizzazione dei risultati da 1 a 9 su 9
  1. #1
    Utente di HTML.it L'avatar di [trodat]
    Registrato dal
    Oct 2004
    Messaggi
    2,135

    Upload Baol: problemi con nome file

    Ciao a tutti.

    Utilizzo il codice di Baol per l'uplaod di files sul server.

    Il form di invio è questo:

    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>
    Come si può vedere ad ogni input type="file" corrisponde un input type="text" chiamato "Nota".

    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
    Lo Stato dà un posto. L’impresa privata dà un lavoro. – Indro Montanelli

  2. #2
    Utente di HTML.it L'avatar di [trodat]
    Registrato dal
    Oct 2004
    Messaggi
    2,135
    up
    Lo Stato dà un posto. L’impresa privata dà un lavoro. – Indro Montanelli

  3. #3
    ma fare un:

    codice:
    while not oUpload.eof
    
    response.write oUpload.Files("InputName") & "
    "
    response.write oUpload.Files("Name") & "." & oUpload.files("ext") & "
    "
    
    oUpload.movenext
    wend
    senza tutti quegli if?
    IP-PBX management: http://www.easypbx.it

    Old account: 2126 messages
    Oldest account: 3559 messages

  4. #4
    Utente di HTML.it L'avatar di [trodat]
    Registrato dal
    Oct 2004
    Messaggi
    2,135
    Va in errore: error '80020009' sempre sulla stessa riga, cioè questa:

    codice:
    strSql = strSql & "  'http://www.mywebpage.com/public/files/"& oUpload.Files("Name") & "." & oUpload.files("ext")  &"', "
    Codice completo:

    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)
    
    while not oUpload.eof
    
    response.write oUpload.Files("InputName") & "
    "
    response.write oUpload.Files("Name") & "." & oUpload.files("ext") & "
    "
    
    oUpload.movenext
    wend
    
     .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/"& oUpload.Files("Name") & "." & oUpload.files("ext")  &"', "
    strSql = strSql & "  '" & arrNota(i) & "' "
    strSql = strSql & " ) "
    cn.execute strSql
    
     .MoveNext
    
    next
    
    Wend
    
    End With
    Set oUpload = Nothing
    
    end if
    Lo Stato dà un posto. L’impresa privata dà un lavoro. – Indro Montanelli

  5. #5
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Vedo tre cicli: 2 sulla classe e uno sull'array....

    Roby

  6. #6
    Utente di HTML.it L'avatar di [trodat]
    Registrato dal
    Oct 2004
    Messaggi
    2,135
    Originariamente inviato da Roby_72
    Vedo tre cicli: 2 sulla classe e uno sull'array....

    Roby
    Scusami ma non capisco cosa vuoi dirmi.... o suggerirmi...
    Lo Stato dà un posto. L’impresa privata dà un lavoro. – Indro Montanelli

  7. #7
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    Hai ciclato due volte la classe...
    While Not .Eof
    while not oUpload.eof e quest'utlima dentro la for...

    sei sicuro che sia corretto?

    Roby

  8. #8
    Utente di HTML.it L'avatar di [trodat]
    Registrato dal
    Oct 2004
    Messaggi
    2,135
    Originariamente inviato da Roby_72
    Hai ciclato due volte la classe...
    While Not .Eof
    while not oUpload.eof e quest'utlima dentro la for...

    sei sicuro che sia corretto?

    Roby
    No, non sono sicuro... ho provato il suggerimento di Santino... ma l'errore è sempre lo stesso e si verifica perchè uno dei campi input type="file" non contiene file da inviare in upload al server...
    Lo Stato dà un posto. L’impresa privata dà un lavoro. – Indro Montanelli

  9. #9
    Utente di HTML.it L'avatar di [trodat]
    Registrato dal
    Oct 2004
    Messaggi
    2,135
    up
    Lo Stato dà un posto. L’impresa privata dà un lavoro. – Indro Montanelli

Permessi di invio

  • Non puoi inserire discussioni
  • Non puoi inserire repliche
  • Non puoi inserire allegati
  • Non puoi modificare i tuoi messaggi
  •  
Powered by vBulletin® Version 4.2.1
Copyright © 2026 vBulletin Solutions, Inc. All rights reserved.