Click here to Skip to main content
15,886,104 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi guys,

I want to know,

What will be best approach to store images?

storing the images in the database or in the folder n just storing its url in d database???

Because, i have both(database n website) on the hosting server.

Plzzzz.... guys let me know, what i have to implement.

Thanks
Posted
Updated 14-Jun-14 20:22pm
v2
Comments
DamithSL 15-Jun-14 2:23am    
It depends both these approaches having pros and cons, you need to decide it based on the requirements. check http://stackoverflow.com/questions/3748/storing-images-in-db-yea-or-nay[^]

I suggest storing the audio and video files in some storage device and only store their paths and meta information in the database. When you need to retrieve these media files, then look for their paths in the database.
Read more: what-is-the-best-way-to-store-media-files-on-a-database[^]
 
Share this answer
 
IMHO there is no 'best approach'.
The main reason to store image (Binary large object - BLOB) in database in the first place is to add some ability to order/structure your BLOBs data. So if this is not your case (you only look for a storage) do not!
There are two main problems with BLOB
1. encoding the binary data so it's content will not break SQL
2. slow in comparison to file system storage
So if you have no reason to store in SQL do it with the file system.
However storing on the file system has the disadvantage of separate security, as someone not allowed into SQL can possibly delete the files form the filesystem...
For that you may use FILESTREAM[^], that exists since SQL 2008...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900