What is the best way to use classic ASP and MySQL Blobs

Im trying to write pages for an admin back end for an image gallery in Classic ASP. Does anyone know of tutrials or modukles out there to help.
Who is Participating?
Sorry for the delay was away for Xmas!   I'm not familiar with PureASP Upload 3 and haven't found a helpful manual.   Most upload components will provided you with access to the raw binary data from the file that was uploaded - usually something like (this is for the a component called "ABCUpload")...

Set theForm = Server.CreateObject("ABCUpload4.XForm")
Set theField = theForm("filefield")(1)

Then on line 6 of my code you can use the value:  theField.Data  as this holds the raw binary data from the file e.g  RS("FieldNameOfYourBlob").Value=theField.Data

I hope this is of some help - if you are still stuck it might be worth posting the question again but mentioning that you are using "PureASP Upload 3" so that an expert familiar with this component will take it up.
My suggestion would be to never store blobs in a database.
1. They are very hard to maintain and a pain to extract
2.  Your database backups will be emense!
3.  The size of your database and performance may go down if it gets loaded. This was my experience anyway
I would suggest storing the location of the file in the database and have the actual file in an organised file system within your web server.
You can find Image upload scripts everywhere, just save the file to the file system, then save the record in your database and you are set.
You will be better off writing it yourself because it if ever breaks you have a better chance of actually fixing it :)
If you still want help with the blobs i will
bobbby_Author Commented:
Hi apresto

I'm storing the locatoon at the moment. The database is on a different machine sos maybe thje performance is not an issue. The galleries will only be a few images and I was wondering if it would be an easier experience for the client if the image went straight into the database with no worries about folders etc. The hoster is jumpy about stting read write permissions on any folder because of hacking (paranoid maybe)

It would be nice to be able to this anyway. I'm busy swapping to .NET but my boss does not give this a prority. yet|

The code below shows how to add the image data into the database, assuming its call binaryimagedata - you will need to work the code out to get the image data based on how you do the upload.

I do store "thumbnails" in a database and it works very nicely.  However I also use ASPJPEG to resize every image that is uploaded before adding it to the database which ensures that amount of data for each image is relatively small.

If you need help getting the image back, or with the upload bit then let me know - I will also need to know if what upload component you are using if you want me to help develop code.
Set Conn = Server.CreateObject("ADODB.Connection")
Set RS = Server.CreateObject("ADODB.Recordset")
RS.Open "YOURTABLE", Conn, 1, 3

Open in new window

bobbby_Author Commented:
Hi R_Harrison

Thanks for this. Yes I would like help getting the image back. I need to "upload" and store then, retrieve and display. I use PureASP Upload 3 with the "advanced multiupload" add on from DMXZone, but I'm not so sure that batch uploading them is OK in this case. Is it this simple? what was all that stuff about opening streams I read about? :o)

Merry Xmas

Bob Scott
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.