Visualizzazione dei risultati da 1 a 3 su 3

Discussione: pure asp upload

  1. #1

    pure asp upload

    Ho provato a modificare il file per l'inserimento (che funziona) in un file per aggiornare
    ma mi da errore

    Errore di run-time di Microsoft VBScript (0x800A01A8)
    Necessario oggetto: ''

    Qualche suggerimento....grazie

    <%@LANGUAGE="VBSCRIPT"%>


    <%
    if Session("login") = "" then
    Response.Redirect("../../ausl.asp")
    end if
    if Session("idausl") = "" then
    Response.Redirect("../../ausl.asp")
    end if
    'Sample file Field-SaveAs.asp
    'Store extra upload info to a database
    ' and file contents to the disk
    Server.ScriptTimeout = 5000

    'Create upload form
    'Using Huge-ASP file upload
    'Dim Form: Set Form = Server.CreateObject("ScriptUtils.ASPForm")
    'Using Pure-ASP file upload
    Dim Form: Set Form = New ASPForm %><%


    Server.ScriptTimeout = 1000
    Form.SizeLimit = &HA00000'10MB

    'was the Form successfully received?
    Const fsCompletted = 0

    If Form.State = fsCompletted Then 'Completted

    'Create destination path+filename for the source file.
    Dim DestinationPath, DestinationFileName, FileField
    DestinationPath = Server.mapPath("archivi")
    DestinationFileName = DestinationPath & "\" & Form("SourceFile").FileName


    'Open recordset to store uploaded data
    Dim RS: Set RS = OpenUploadRS

    'Store extra info about upload to database
    'RS.AddNew
    RS("UploadDT") = Now()
    RS("Nome_Commerciale") = Form.Texts.Item("Description")
    RS("SourceFileName") = Form("SourceFile").FilePath
    RS("DestFileName") = DestinationFileName
    RS("DataSize") = Form("SourceFile").Length
    RS("idausl") = Session("idausl")
    RS("produttore") = Form.Texts.Item("produttore")
    'RS("schedasicurezza") = RS("contatore") &"-" & Form("SourceFile").FileName
    'RS("ID_sostanze") = RS("contatore") + Session("idausl") * 100000000
    'DestinationFileName
    '...
    RS.Update

    Response.write "
    Source file names:"
    Dim Field: For Each Field in Form.Files.Items
    Response.write "
    " & Field.FileName
    Next
    '{b}Save file to the destination
    Form("SourceFile").SaveAs DestinationFileName
    '{/b}
    response.write "<Font color=green>
    SourceFile was saved as " & DestinationFileName
    response.write "
    See ListFiles table in " & Server.MapPath("upload.mdb") & " database.</Font>"

    ElseIf Form.State > 10 then
    Const fsSizeLimit = &HD
    Select case Form.State
    case fsSizeLimit: response.write "
    <Font Color=red>Source form size (" & Form.TotalBytes & "B) exceeds form limit (" & Form.SizeLimit & "B)</Font>
    "
    case else response.write "
    <Font Color=red>Some form error.</Font>
    "
    end Select
    End If'Form.State = 0 then

    Function OpenUploadRS()
    Dim RS : Set RS = CreateObject("ADODB.Recordset")
    ID_sostanze=request("ID_sostanze")
    sql = "SELECT * FROM sitosostanzeinserimento where ID_sostanze LIKE '%"&ID_sostanze&"%'"
    'Open dynamic recordset, table Upload
    RS.Open sql, GetConnection, 2, 2

    Set OpenUploadRS = RS
    end Function

    Function GetConnection()
    dim Conn: Set Conn = CreateObject("ADODB.Connection")
    Conn.Provider = "Microsoft.Jet.OLEDB.4.0"
    Conn.open "Data Source=" & Server.MapPath("\..\..\audit.mdb")
    set GetConnection = Conn
    end function



    %>

    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML><HEAD>
    <TITLE>ASP huge file upload sample.</TITLE>
    <STYLE TYPE="text/css">
    <!--TD {font-family:Arial,Helvetica,sans-serif }TH {font-family:Arial,Helvetica,sans-serif }TABLE {font-size:10pt;font-family:Arial,Helvetica,sans-serif }body {
    background-color: #AFCD9C;
    }
    .Stile8 {font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 16; }
    .Stile9 {font-size: 16pt}
    .Stile10 {font-size: 16}
    .Stile11 {font-size: 16px}
    -->
    </STYLE>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"></HEAD>
    <BODY>
    <Div style=width:600>
    <TABLE cellSpacing=0 cellPadding=0 width="100%" border=0>

    <TR>
    <TH noWrap align=left width="20%" bgColor=#AFCD9C></TH>
    <TD></TD></TR></TABLE>
    <TABLE cellSpacing=2 cellPadding=1 width="100%" bgColor=white border=0>

    <TR>
    <TD colSpan=2>
    <P class="Stile11">Il limite caricabile <%=Form.SizeLimit \ 1024 %>kB . </TD></TR></TABLE>

    <TABLE cellSpacing=1 cellPadding=3 bordercolor=silver bgcolor=GAINSBORO width="" border=1>
    <form name="form1" ENCTYPE="multipart/form-data">
    <TR>
    <TD></TD>
    <TD Align=Right><input name="Action" type="submit" value="Upload il file&gt;&gt;"></TD>
    </TR>
    <TR>
    <TD><span class="Stile11">File da caricare </span></TD>
    <TD><input name="SourceFile" type="file"></TD>
    </TR>
    <TR>
    <TD><span class="Stile11">Nome commerciale</span></TD>
    <TD><span class="Stile8">
    <input name="Description" type="text" size="30">
    </span></TD>
    </TR>
    <TR>
    <TD><span class="Stile11">Produttore</span></TD>
    <TD><input name="produttore" type="text" id="produttore" value="<%RS.fields("produttore")%>" size="30"></TD>
    </TR>
    <TR>
    <TD><span class="Stile11">Ora</span></TD>
    <TD><input name="ora" type="text" id="ora" value="<%=time()%>"></TD>
    </TR>
    <TR>
    <TD><span class="Stile11">Nome commerciale</span></TD>
    <TD></TD>
    </TR>
    <TR>
    <TD><span class="Stile11">Nome commerciale</span></TD>
    <TD></TD>
    </TR>
    <TR>
    <TD></TD>
    <TD></TD>
    </TR>
    <TR>
    <TD></TD>
    <TD></TD>
    </TR>
    <TR>
    <TD></TD>
    <TD></TD>
    </TR>
    <TR>
    <TD></TD>
    <TD></TD>
    </TR>
    </form></Table>

    <HR COLOR=silver Size=1>
    <CENTER>
    </CENTER>
    </Div>
    </BODY>

    la riga incriminata è questa
    </HTML> <TD><input name="produttore" type="text" id="produttore" value="<%RS.fields("produttore")%>" size="30"></TD>

  2. #2
    Moderatore di ASP e MS Server L'avatar di Roby_72
    Registrato dal
    Aug 2001
    Messaggi
    19,559
    L'oggetto RS non esiste o è chiuso.

    Roby

  3. #3
    Risolto con una maniera poco elegante
    ho aperto un altro recordset con dreamweaver per popolare i campi testo e mandare per selezionare il record univoco ID_sostanze

    mentre per aggiornare ho usato il record

    ID= Request.QueryString("ID_sostanze")
    RS.Open "Select * from sitosostanzeinserimento where ID_sostanze =" &ID, GetConnection, 2, 2




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 © 2025 vBulletin Solutions, Inc. All rights reserved.