i have a requirement where i need to save image to database. Iam in confusion whether to save the path of image in database by saving the image in folder
or to save the binary data of image to database. Could any one suggest me which one is best in performance, security etc and why?
If your images are not many (like you just need to show images of some products on some page etc), then you can go on storing them in the DB.
But if you have alot of images to work with in your application, then its better that you store only their paths in the DB and store the images on file system.
Storing the images in the DB, helps securing them better than storing them on file system. But performance will certainly go low if you'll have good amount of images and store then in DB. When images are stored on file system, their caching can also be done.
praveen.k
Member
127 Points
209 Posts
save image as binary data or path
May 05, 2010 07:02 AM|LINK
Hi,
i have a requirement where i need to save image to database. Iam in confusion whether to save the path of image in database by saving the image in folder
or to save the binary data of image to database. Could any one suggest me which one is best in performance, security etc and why?
contactrajku...
Participant
854 Points
213 Posts
Re: save image as binary data or path
May 05, 2010 09:32 AM|LINK
Hi Praveen,
Check this,
http://forums.asp.net/t/1096999.aspx
http://stackoverflow.com/questions/561447/store-pictures-as-files-or-in-the-database-for-a-web-app
http://bytes.com/topic/net/answers/426932-storing-images-folder-database
hassanmehmoo...
Star
8970 Points
1590 Posts
Re: save image as binary data or path
May 05, 2010 09:50 AM|LINK
Hi praveen.
If your images are not many (like you just need to show images of some products on some page etc), then you can go on storing them in the DB.
But if you have alot of images to work with in your application, then its better that you store only their paths in the DB and store the images on file system.
Storing the images in the DB, helps securing them better than storing them on file system. But performance will certainly go low if you'll have good amount of images and store then in DB. When images are stored on file system, their caching can also be done.
--
Mark as answer, if it answers you..
--
Mark as Answer, if it answers you..
--
hans_v
All-Star
35986 Points
6550 Posts
Re: save image as binary data or path
May 05, 2010 11:31 AM|LINK
You can find the answer to all these questions in this article:
http://www.4guysfromrolla.com/articles/120606-1.aspx
praveen.k
Member
127 Points
209 Posts
Re: save image as binary data or path
May 08, 2010 11:34 AM|LINK
Thanks Hans
RonShea
Member
246 Points
42 Posts
Re: save image as binary data or path
May 08, 2010 11:51 AM|LINK
Hi Praveen,
Try below link to save your image as binary data in database and read the image from database.
http://www.beansoftware.com/ASP.NET-Tutorials/Save-Read-Image-Database.aspx
Hope this will help :)
Please mark this as answer if it works for you.
Thanks.