I'm trying to study ASP and sql server 2005 to create the website.However, I don't know how to create a table having a column to store the image, I have never tried this before, I don't know sql server 2005 has data type of image or not.
hmm, the flow is: I will get the image from the user's uploading, insert it into the database, then I can select it and display into the website!
You can show me the tip or the way? please!

8 Years
Discussion Span
Last Post by smariano77

Hi. What I do to store and show images it's this:

1. I store the images that the clients upload, in the same folder, always. Remember to validate the extension, type, and any strage caracters that may crash your app (á, é, ñ) or just use the correct charset.
2. In the table of your dataBase, I create a column (called "images") and there you store the image name (there are some functions to get this).
3. Then, when I want to show the image, I select the name of the dataBase (for example: "happydog.png"). In the codeBehind page, add the full path:

Dim aux as string
dim img as string = "happydog.png"

aux= "data\images\14x14\" & img
response.write("<img src=" & aux "alt=happyDog .... /">

I think you get the idea. Just reply if you don't.



This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.