PDA

View Full Version : bInary Images


charon
04-17-2003, 09:03 AM
Hi,

As we know, we be able to save our images to database by saving their binary data or image path. If we save the binary data we needn't to save the images in image folder. I'm curious to know, which is the best practise??

By saving their binary data, when retrieve the image, I must use the content type Response.ContentType = "image/jpeg" , due to this, the page that I use to display the image can't be use to display their Description as well such as image name and details of the image.

I use this method (OLE object) is because we don't want to create a writable folder for saving the images. (the images are uploaded by users)

Please advice!

david7777
04-17-2003, 09:16 AM
Saving on to disk is much better practice (so im told) :)
Ive also gona around asking the same questions, and came to the conclusion that saving binary data in a database is normally used for small things such as advertising images etc... Im not a pro with permissions for folders on the server, but im sure there is a secure way to still be able to let users upload into your directory...

leolee782003
05-12-2003, 03:16 AM
This version of microsoft.jet.OleDB connector. Let say I wanna changed it into mysql connector. I found that BinaryData field doens;t support in mysql. I set binaryData field to text. However the problem occur. Could anyone tell me more about this.........

strFileName = objUpload.Fields("File1").FileName

Set objConn = Server.CreateObject("ADODB.Connection")
Set objRs = Server.CreateObject("ADODB.Recordset")

' Sometimes I personally have errors with one method on different servers, but the other works.
objConn.Open "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("Files.mdb")
'objConn.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("Files.mdb")

objRs.Open "Files", objConn, 3, 3

objRs.AddNew

objRs.Fields("FileName").Value = objUpload.Fields("File1").FileName
objRs.Fields("FileSize").Value = objUpload.Fields("File1").Length
objRs.Fields("ContentType").Value = objUpload.Fields("File1").ContentType
objRs.Fields("BinaryData").AppendChunk objUpload("File1").BLOB & ChrB(0)

objRs.Update

objRs.Close