If you are developing a web site of photo sharing or albums then you can’t store images into the database, coz this will make your database very bulky to store the other profiles and data. So, you have to adopt the first method to upload the images to a folder.
If content of the image is going to keep changing and application logic needs to process them before delivering it makes more sense to deliver via app server (i.e. you can keep in DB). Where as if images by nature itself is quite static - not changing often and needs to be delivered so many times, (set once read/deliver many times) scenario then, it the web is always a preferred method. this applies irrespective of performance of DB.
Retrieving an image from a database incurs significant overhead compared to using the file system. Disk storage on database SANs is typically more expensive than storage on disks used in Web server farms.
Filesystem, of course, unless you're aiming for a story on thedailywtf. The easiest way is to have the photos organized by a property you can derive from the file itself, such as its SHA-1 hash. Then just store the hash in the database, attached to the photo's primary key and other attributes (who uploaded it, upload date, etc).
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)