MS SQL 7 - image data type + ASP

Results 1 to 2 of 2

Thread: MS SQL 7 - image data type + ASP

  1. #1
    Dooo Guest

    Default MS SQL 7 - image data type + ASP

    I&#039;m in trouble when tring to insert an image in a database via ASP.<BR>I have a table with imgsource column from image type.<BR>imgname is text.<BR>The form:<BR>&#060;form name="AddPict" method="post" action="addpicture.asp" ENCTYPE="multipart/form-data"&#062; <BR>&#060;input type="text" name="imgname" value=""&#062;<BR>&#060;input type="file" name="imgsource"&#062;<BR>&#060;input type="submit" value="Add picture" name="submit1"&#062;<BR>&#060;/form&#062;<BR><BR>usual connection to db, recordset <BR><BR>objRS.AddNew<BR> objRS.Fields("imgname") = Request.Form("imgname")<BR> objRS.Fields("imgsource") = Request.Form("imgsource")<BR>objRecordset.Update<B R><BR>I got no error. <BR>But when I select value in MS SQL I got NULL.<BR>What could be wrong?<BR><BR>Thanks!<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: MS SQL 7 - image data type + ASP

    The image data type is actually a blob (binary large object). It is expecting binary data to be inserted. When you use ENCTYPE="multipart/form-data" the browser converts the binary image file into text to be sent in the header back to the server. Your receiving code needs to convert that back into binary before inserting. I would highly suggest using a fileupload type script instead of putting it in your database. It is much quicker to use your servers file system to display a graphic than to do it through the Database. Here is some more info on fileuploading:<BR><BR><BR><BR>I found a real good example at but it now requires you to register.

Posting Permissions

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