shams.hq wrote:It really depends what you want to do. If they're directly linked to some other entity (eg, a person/client's photograph), I suspect a database would be better; if it's simply a library of images then a directory or tree may well be sufficient (and simpler).
i want to know that which is better to store images either file-system or database?
i am developing a social networking web site and there will be too many images and also to be of larger size.
ForumKid2 wrote:Very valid points - another note: if you do opt to store them on you filesystem, do not do so on your app servers. As ForumKid2 pointed out, it's messy.
One thing to consider is clustering. If you have multiple clustered servers for failovers, etc, then likely your files (if kept on the file system) will be duplicated on multiple hosts and is cumbersome to manage. If you keep the files in the database then you can have one database (clustered or not) and avoid having multiple copies of the same file.
There are advantages and disadvantages to both situations. In a non-clustered environment, I tend to keep all files on the filesystem. It keeps the database size to a minimal. In clustered environments I tend to keep them in a separate table and/or schema where other tables know how to retrieve them by key, etc.