Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Write IMAGE datatype to SQL with METHOD=POST

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2001-02-06 : 17:33:53
Phil writes "I'd like to create a form (easy enough) so web visitors can POST a file. Simple enough. Now the hard part.

I'd like to write the file to a SQL 7.0 table (using IMAGE datatype). I'm using ADO for the connection. In addition, I need to capture a few other things about the file. Basically, here is the table:

tblFiles
    intFileID (int) pk
    dtFile (smalldatetime)
    vcharAuthor (varchar(50))
    binData (image)

and of course, the HTML FORM
[<]FORM
  METHOD=POST
  ACTION="myasp.asp"
  ENCTYPE="multipart/form-data" >
[<]INPUT
  TYPE=FILE
  NAME="filename">
[<]INPUT
  TYPE=HIDDEN
  NAME="author"
  VALUE="
  [<]%
    Response.write Request.ServerVariables("AUTH_USER")
  %[>]
  ">
[<]INPUT
  TYPE=SUBMIT>
[<]/FORM>

The whole thing is on IIS/NT 4.0/SQL 7.0 (SP whatever-is-current)"
   

- Advertisement -