faqts : Computers : Databases : Microsoft SQL Server

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

57 of 90 people (63%) answered Yes
Recently 6 of 10 people (60%) answered Yes

Entry

Should I store an image file directly in the database or store it's url in the database?

Apr 15th, 2008 07:54
Taksh Verdhan, Cortez Cortez, Tony Hughes, Subbu S,


There are a few considerations for this question. I'm assuming you have
a file upload system and are storing the images locally on the server.
If you store just the URL to the image in the database, then all that
the server needs to process is that text field.  The client (i.e. the
browser) then retrieves the image at that location.  You need to be
particularly careful that the users don't upload non-image files such as
viruses or scripts, that the permissions of the upload folder are set
properly, and so on.  This method is easy on the server.  If the images
are not stored locally then you will possibly have missing images.
The other way is to store the whole image in the database, and if the
images are large, or there are a lot of them, you end up having a
massive database.  This can be a problem if you're using something like
Access.  However, if your database solution can handle it (I'm thinking
Oracle, SQL server, MySQL) then this can actually be an advantage.  If
the database is loaded into RAM, then images which are frequently
accessed can be served quickly instead of going to disk (if you have a
good server setup this will happen regardless).  Also, you have more
control over how the images are displayed because the image is produced
as part of a query attached to the larger page.  For example, each image
record could have virtually unlimited fields attached to it, like which
users or user groups can view it.  You can store this information in a
database anyway but if the actual image is with that data, it really
hands you more control over the image.
Remember that in database form you can't easily copy the images from one
folder to another, with FTP or something like that.  A file system is
really just another database, and by putting the files in your own
database you're limiting yourself to your own tools.
http://linkexchange-7.blogspot.com/
http://eroticreview.blogspot.com/
http://friendsreuniteddating.blogspot.com/
http://romaniandating.blogspot.com/
http://myspaceadvertising.blogspot.com/
http://newofficefurniture.blogspot.com/
http://web20box.blogspot.com/
http://carautoaccessories.blogspot.com/
http://sainisamaj.blogspot.com/
http://beyonceknowleshotphoto.blogspot.com/
http://linkexchange7.blogspot.com/
http://beyonceknowlesphoto.blogspot.com/
http://viewsat.blogspot.com/
http://paiddirectoy.mylinea.com/
http://linkchannel.mylinea.com/
http://businessdirs.mylinea.com/
http://allwebdirectory.mylinea.com/
http://seopdir.mylinea.com/
http://automotivedir.mylinea.com/
http://myspacedirectoy.mylinea.com/
http://bs049-myl.mylinea.com/