Reputation: 15138
in my new c#.net 3.5 ASP Website, user have the possibility to upload a picture.
What solution is the best for saving this picture? Should I save it on my server in a folder and save the path in the database, or should I save the picture in the database?
Upvotes: 2
Views: 678
Reputation: 113272
Pro files:
Pro DB:
Upvotes: 2
Reputation: 160902
It is not recommended to store large files/pictures in the DB, but you can. For that use a column of type varbinary.
As of SQL Server 2008, you can also save BLOBs=files on the disk but still have SQL server refer to them with the help of the filestream storage attribute. You can check basics of the performance differences here.
Upvotes: 0
Reputation:
Should I save it on my server in a folder and save the path in the database
You could do something like that or...
you can take advantage of the FILESTREAM feature in SQL Server 2008.
Files will be stored on disk but transparently manipulated as though they were directly in a database field. Lessens load on the database and constraints the database explosive growth, especially if you take advantage of NTFS streaming for accessing those files.
An Introduction to SQL Server FileStream
Upvotes: 0