Exact Duplicate: User Images: Database or filesystem storage?
Exact Duplicate: Storing images in database: Yea or nay?
Exact Duplicate: Should I store my images in the database or folders?
Exact Duplicate: Would you store binary data in database or folders?
Exact Duplicate: Store pictures as files or or the database for a web app?
Exact Duplicate: Storing a small number of images: blob or fs?
I have to store user's profile image (100px * 100px) what is the best way to store it ? database or system file ? which one is better , faster ,safer ... ?
Always store images, music files etc in system files on disk, and then store the url:s to them in the database. That will make it
1) faster
2) easier to configure security settings
3) better in any ways I can imagine
database makes it easier to backup and restore and it works better than file system storage for small images. Microsoft had published a research paper on this topic: To BLOB or Not To BLOB.
I am going to propose a third option, a third-party party place like Amazon S3 or Mosso Cloud Files. Both provide APIs that you can use to upload the file and both provide CDN capabilities so the files will load quicker then they would off your servers or pulling from your database.
This is a nice option because it is the best of both worlds. The downside of storing images in the database is that it is additional stress on your application and database servers (locating the file and pulling it) and it also causes your database to grow in size which can mean you will need more hardware earlier.
The downside of storing them in the file system is that you now have an issue with scaling as if you want to add additional web servers they would each need a copy of the image or you would need create a dedicated server for these images. Also, file system access could be a future bottleneck to worry about.
SQL Server 2008 offers the best of both worlds.