English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

i am creating a website where i wanna to upload images to a database and then display that image on the page my web site is on asp, i wanna to know that how to upload a image and store that image to that database in asp page and then display it. please help me out if any body knows, Thanx in advance

2006-12-25 20:08:53 · 4 answers · asked by amit_shri05 2 in Computers & Internet Programming & Design

4 answers

Rather upload the picture and just store the pfad in the database. Then use the pfad to display the image!

Helmut

2006-12-25 20:38:19 · answer #1 · answered by hswes 2 · 0 0

No offense to the other people who answered, but their answers are incorrect.

1) You can definitely store images in a database, the data type is a Binary Large Object (BLOB), google it and you will find help in any RDBMS of your choice on how to implement.

2) The overhead of storing the BLOB in the database is often no more than storing it in the filesystem. A byte, is a byte is a byte. A database is only a mechanism to store data, but the data is not really any larger then if you stored the raw file.

There are always two ways to handle your problem. Storing on the filesystem has a couple of downsides. One of which is how to make sure the DB is in sync with the Filesystem. If a file were to be deleted from the Filesystem, and you tried to retrieve if from the db, you would have an error. Not catastrophic, just needs to be coded for. The alternate problem, is how do you clean up the Filesystem, when a file is removed and the DB column isn't updated.

Another set of issues is how do you manage security when you are using the DB for storing the image file name and the filesystem for storing.

On the other hand storing the BLOB in the database can be a little more difficult to code, and there might be issues around moving the images. Sometimes people want to store the images on the webserver or SAN for computer ops reasons.

For a simple DB/app, putting it in the db is perfectly ok.

2006-12-26 04:32:16 · answer #2 · answered by anothersillypersonalsname 2 · 0 0

i'd store the path of the image file on the database rather than the image itself. I'm not even sure if u can store actual image in the database. Even if you can, there'll be a lot of overhead involved.

2006-12-25 21:23:14 · answer #3 · answered by Anonymous · 0 1

You cant store the actual image in the dB. what you need to do is:

1) upload the image on the web server (if its an image then the ideal name would be an 'image' directory)
2) after a *successful* image upload, store the image name and its path in the dB. If the image path and name is "C://inetpub/wwwroot/mydomain/image/mypic.jpg", you would store "image/mypic.jpg" in the dB.

So all you need to do next is (from code) query the dB to get the image and then display it on the web.

2006-12-26 03:51:12 · answer #4 · answered by The First 3 · 0 1

fedest.com, questions and answers