www.webdeveloper.com
Results 1 to 5 of 5

Thread: Simple Persits Upload script acting funny...

Hybrid View

  1. #1
    Join Date
    Feb 2004
    Posts
    1,345

    Question Simple Persits Upload script acting funny...

    The script working only if I'm attaching a file. I not, it won't let me enter the rest of the text into the database.

    The code:

    Code:
    Set Upload = Server.CreateObject("Persits.Upload.1")
    
    Upload.OverwriteFiles = False
    On Error Resume Next
    
    Upload.SetMaxSize 1048576 'Limit files to 1MB
    Count = Upload.Save("c:\hosting\mydomain")
    
    If Err <> 0 Then
        Err.Description
    Else
        color = Upload.Form ("color")
        size = Upload.Form ("size")
    
        Set File = Upload.Files(1)
        File.OriginalPath
    
        set con = server.CreateObject("ADODB.Connection")
        con.Open DSN
        SQL = "INSERT INTO testTBL (color,size,myfile) VALUES('" & shape & "', '" & size & "', '" & File.OriginalPath & "')"
    
        con.Execute SQL
    End If
    
    con.close
    set con = Nothing
    
    response.redirect "great.asp"
    What can it be?

    Thanks!

  2. #2
    Join Date
    Aug 2005
    Location
    Karachi, Pakistan
    Posts
    55

    Check !

    Remove this line of code

    On Error Resume Next


    And check if some error raises. Then you can better debug the code.

  3. #3
    Join Date
    Feb 2004
    Posts
    1,345
    I got an error actually:

    Index out of range.
    /page.asp, line 37

    The line is:
    Set File = Upload.Files(1)

  4. #4
    Join Date
    Feb 2004
    Posts
    1,345
    Thanks!

  5. #5
    Join Date
    Jan 2003
    Location
    Dundee, Scotland
    Posts
    1,367
    Hi,
    can you try the line without the SET?
    If still not working what you want to do is put the file upload stuff in an while loop and only run if file is selected.
    Code:
    For Each File in Upload.Files
    Response.Write File.Name & "= " & File.Path & " (" & File.Size &" bytes)<BR>"
    Next

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles