|
-
Oct 7th, 2007, 12:31 AM
#1
Thread Starter
Addicted Member
Crash Course in Images
Hi,
For so long now I cannot figure out how to read files from a database and how to upload a file to DB.
If anyone knows how to please could you assist me with some simplified samples.
Thanks.
-
Oct 9th, 2007, 06:13 AM
#2
Addicted Member
Re: Crash Course in Images
I am by no means an expert but this is how i did the saving in a vb app using Access as the backend
the field in access was set to a ole object i think
you shouldn't have to change much for ASP
Code:
Dim mystream As New ADODB.Stream
Set mystream = New ADODB.Stream
mystream.Type = adTypeBinary
RS.CursorLocation = adUseClient
RS.ActiveConnection = cn
RS.Open "SELECT imgName,Image FROM tblImages WHERE imgName = ''"
RS.AddNew
mystream.Open
mystream.LoadFromFile "Image location"
RS.Fields("imgName") = "ImageName"
RS.Fields("Image") = mystream.Read
RS.Update
RS.Close
mystream.Close
-
Oct 13th, 2007, 10:20 PM
#3
Thread Starter
Addicted Member
Re: Crash Course in Images
Thanks ooKmonkey.. I will be using VB.NET to place the image into the DB and using ASP to read it back onto a website.
I could use a tool to do all this but I rather learn and know how its accomplished. I will give it a go and write back with my result.
Thanks again
-
Oct 16th, 2007, 05:19 AM
#4
Thread Starter
Addicted Member
Re: Crash Course in Images
Ok. Here is what I did.
I created a Access DB this is what I am trying to do in ASP to view the picture.
It shows all jibberish, which I guess its right, but now what is next? Thanks
Code:
<!-- #include file="adovbs.inc" -->
<%
response.Buffer = true
dim con, com, rec
set con = server.CreateObject("ADODB.Connection")
set com = server.CreateObject("ADODB.Command")
set rec = server.CreateObject("ADODB.RecordSet")
con.open "Provider=Microsoft.JET.OLEDB.4.0; Data Source = D:\UITS\DB_Cars.mdb"
com.activeconnection = con
com.commandtype = adCMDText
com.commandtext = "SELECT * FROM Images"
rec = com.execute
response.ContentType = "images/jpeg"
response.BinaryWrite(rec("ImageFile"))
%>
Last edited by TURKINATOR; Oct 24th, 2007 at 06:06 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|