aspUpload: what am I doing wrong?

Discussion in 'ASP General' started by John, Feb 12, 2005.

  1. John

    John Guest

    I can get this to upload files but I can't get items out of the Files
    collection into the database. I'm getting this error

    Microsoft VBScript runtime error '800a005b'

    Object variable not set

    /admin/media_upload_recording_process.asp, line 94


    I don't entirely understand use this. I've gone over their website manual
    and I don't really grasp how to do this. Can anyone help?

    Thanks!

    <%
    Set Upload = Server.CreateObject("Persits.Upload.1")
    ' Upload files
    Upload.SetMaxSize 1048576 ' Truncate files above 1MB
    Upload.Save "e:\InetPub\Clients\thehalftonhorns.com\media\"

    If Err <> 0 Then
    Response.write _
    "<span class='smallRed'>The following error occured while
    uploading</span><br>" & _
    "<span class='smallWhite'>" & Err.Description & "</span>" & _
    "<span class='smallGray'>To try again<A
    HREF='/media_upload_recordings.asp'>click here</A>.</span>"
    Else
    'show upload results
    Response.write _
    "<table width='100%' bordercolor='#808080' border='1' cellpadding='0'
    cellspacing='0'>" & _
    "<th align='left' class='smallGray'>Uploaded File</th><th align='left'
    class='smallGray'>Size</th><th align='left' class='smallGray'>Original
    Size</th>" & _
    "<tr>"
    For Each File in Upload.Files
    If File.ImageType = "GIF" or File.ImageType = "JPG" or File.ImageType =
    "PNG" Then
    Response.write _
    "<td align=center valign='bottom'>" & _
    "<img src='/media/" & File.FileName & "'><BR>" & _
    File.OriginalPath & "<BR>" & _
    "(" & File.ImageWidth & " x " & File.ImageHeight & " pixels)" & _
    "</td>"
    Else
    Response.write _
    "<td class='smallWhite'>" & File.FileName & "</td>"
    End If
    Response.write _
    "<td class='smallWhite' align='right' valign='top'>" & File.Size &
    "bytes</td>" & _
    "<td class='smallWhite' align='right' valign='top'>" & File.OriginalSize
    & "bytes</td>" & _
    "</tr>"
    Next
    Response.write "</table>"

    Set setlistConn = Server.CreateObject("ADODB.Connection")
    setlistConn = "Provider=Microsoft.Jet.OLEDB.4.0; " & _
    "Data Source= e:\xxxxx\cgi-bin\recordings.mdb"

    Dim objCommand
    Set objCommand = Server.CreateObject("ADODB.Command")
    objCommand.ActiveConnection = setlistConn
    objCommand.CommandText = "INSERT INTO
    tblRecordings(recordingTitle,recordingFileName,recordingFileSize,recordingFi
    leDate) VALUES('" & Upload.Form("title") & "','" &
    Uploaded.File("File.FileName") & "," & Upload.Files("File.FileSize") & "," &
    now & "');"
    objCommand.CommandType = adCmdText
    objCommand.Execute
    Set objCommand = Nothing
    John, Feb 12, 2005
    #1
    1. Advertising

  2. Which line is line 94?


    --
    Jason Brown
    Microsoft GTSC, IIS

    This posting is provided "AS IS" with no warranties, and confers no
    rights.

    "John" <> wrote in message
    news:3PtPd.3504$...
    >I can get this to upload files but I can't get items out of the Files
    > collection into the database. I'm getting this error
    >
    > Microsoft VBScript runtime error '800a005b'
    >
    > Object variable not set
    >
    > /admin/media_upload_recording_process.asp, line 94
    >
    >
    > I don't entirely understand use this. I've gone over their website manual
    > and I don't really grasp how to do this. Can anyone help?
    >
    > Thanks!
    >
    > <%
    > Set Upload = Server.CreateObject("Persits.Upload.1")
    > ' Upload files
    > Upload.SetMaxSize 1048576 ' Truncate files above 1MB
    > Upload.Save "e:\InetPub\Clients\thehalftonhorns.com\media\"
    >
    > If Err <> 0 Then
    > Response.write _
    > "<span class='smallRed'>The following error occured while
    > uploading</span><br>" & _
    > "<span class='smallWhite'>" & Err.Description & "</span>" & _
    > "<span class='smallGray'>To try again<A
    > HREF='/media_upload_recordings.asp'>click here</A>.</span>"
    > Else
    > 'show upload results
    > Response.write _
    > "<table width='100%' bordercolor='#808080' border='1' cellpadding='0'
    > cellspacing='0'>" & _
    > "<th align='left' class='smallGray'>Uploaded File</th><th align='left'
    > class='smallGray'>Size</th><th align='left' class='smallGray'>Original
    > Size</th>" & _
    > "<tr>"
    > For Each File in Upload.Files
    > If File.ImageType = "GIF" or File.ImageType = "JPG" or File.ImageType =
    > "PNG" Then
    > Response.write _
    > "<td align=center valign='bottom'>" & _
    > "<img src='/media/" & File.FileName & "'><BR>" & _
    > File.OriginalPath & "<BR>" & _
    > "(" & File.ImageWidth & " x " & File.ImageHeight & " pixels)" & _
    > "</td>"
    > Else
    > Response.write _
    > "<td class='smallWhite'>" & File.FileName & "</td>"
    > End If
    > Response.write _
    > "<td class='smallWhite' align='right' valign='top'>" & File.Size &
    > "bytes</td>" & _
    > "<td class='smallWhite' align='right' valign='top'>" & File.OriginalSize
    > & "bytes</td>" & _
    > "</tr>"
    > Next
    > Response.write "</table>"
    >
    > Set setlistConn = Server.CreateObject("ADODB.Connection")
    > setlistConn = "Provider=Microsoft.Jet.OLEDB.4.0; " & _
    > "Data Source= e:\xxxxx\cgi-bin\recordings.mdb"
    >
    > Dim objCommand
    > Set objCommand = Server.CreateObject("ADODB.Command")
    > objCommand.ActiveConnection = setlistConn
    > objCommand.CommandText = "INSERT INTO
    > tblRecordings(recordingTitle,recordingFileName,recordingFileSize,recordingFi
    > leDate) VALUES('" & Upload.Form("title") & "','" &
    > Uploaded.File("File.FileName") & "," & Upload.Files("File.FileSize") & ","
    > &
    > now & "');"
    > objCommand.CommandType = adCmdText
    > objCommand.Execute
    > Set objCommand = Nothing
    >
    >
    >
    Jason Brown [MSFT], Feb 14, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Rebbeck

    Problem with Persits ASPUpload

    John Rebbeck, Jul 11, 2003, in forum: ASP General
    Replies:
    3
    Views:
    155
    John Rebbeck
    Jul 14, 2003
  2. Guest

    AspUpload Configuration

    Guest, Jul 28, 2003, in forum: ASP General
    Replies:
    0
    Views:
    103
    Guest
    Jul 28, 2003
  3. Guest

    anyone familiar with ASPUpload?

    Guest, Aug 14, 2003, in forum: ASP General
    Replies:
    0
    Views:
    122
    Guest
    Aug 14, 2003
  4. Lars

    CDONTS and ASPUpload

    Lars, Sep 14, 2003, in forum: ASP General
    Replies:
    1
    Views:
    107
    Curt_C [MVP]
    Sep 14, 2003
  5. Vilmar Brazão de Oliveira

    Renaming a file with aspupload or FSO?

    Vilmar Brazão de Oliveira, Jan 13, 2004, in forum: ASP General
    Replies:
    5
    Views:
    181
    Roland Hall
    Jan 14, 2004
Loading...

Share This Page