nz******@cs.mun.ca wrote:
I am currently upgrading a database of products to include pictures to
be displayed online. I would like to know whether it would be best to
store the pictures themselves in a database as a BLOB or whether it
would be best to simply store the filename. What are the pros and
cons?
Store as files:
+ Easy to make, easy to use. It can be difficult to read imagefiles from
database and then show them to user. It is often much simpler just to
generate a link to imagefile.
+ If database is down, files are still usable (if program logic allows that)
+ Database backups won't take that much space, which is a good thing, if
you don't need to make backups from files that often or at all.
- Backups require you to store the database + folder where images are,
which means more work for backupping.
- Copying the whole system for example to another server is often more
easy to do if all data is inside one database.
- If files should not be accessed by anyone, user access control to the
images is easier to handle, if data is inside database.
- Remote access to database requires remote access to files folder also.
If you don't need remote access, or strict user control, you will
propably be happier if you store the images into a folder instead of
database.