Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003

    Question Unanswered: Uploading a file from a client machine to another SQL website server


    I'm having trouble getting files to upload through the browser from one machine to another. I can upload files from the browser to the SQL database if they are both on the same machine but I can't seem to get it to work when the client is on a different machine than the SQL server and website.

    I get the following error:

    Error Type:
    ADODB.Stream (0x800A0BBA)
    File could not be opened.

    Strange thing is, I got this to work once, from another machine here at work but for some reason I must have changed something as it no longer works right.

    *** CODE SAMPLE ***

    strFilename = Request("filepath")

    Dim rs
    Set rs = Server.CreateObject("ADODB.Recordset")

    Dim stm
    Set stm = Server.CreateObject("ADODB.Stream")

    'Read the binary files from disk.
    stm.Type = adTypeBinary
    stm.LoadFromFile(strFilename) ***CRASHES HERE***


    Set rs = Nothing
    Set stm = Nothing

  2. #2
    Join Date
    Jul 2003
    That only works because LoadFromFile executes on the server, not on the client. You need to use the <input type="file"> in a form which sends the file to the server. Then you can put that BLOB into the database.

    Look up some sites in Google on retrieving files from forms. You can do it with pure ASP, or you can purchase something like SAFileUp which puts all the components you need into a COM.
    That which does not kill me postpones the inevitable.

  3. #3
    Join Date
    Sep 2003
    Yes, I am using the type="file" input in my form, just didn't include it in the sample.

    I'm trying to avoid using any third party alternatives at this point. I know it works as I've done it from another machine on the network, but I must have made some changes since as it no longer works. I have no problem inserting the blob into the database as I've done it many times when browsing the database/website while on the same machine.

Posting Permissions

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