How can I dynamically insert images when user uploads an image file to SQL Server 2005 with C# in ASP.NET? This is to let users upload their profile photos in my web app. Is it very different from how it is done for windows app with C#?
+1
A:
The same way as in in WinForms. Get byte[]
and same to image
column. But i strongly recommend to use file system to store pictures. DB is for relational data, File System for raw bytes.
Andrey
2010-09-16 13:10:15
Yes I agree with Andrey, if all you are doing is trying to store user profile pictures, upload them a directory and store their source. Imagine querying a large number of user profile pictures from a database.. you would have huge performance hits!
KennyCason
2010-09-16 13:37:56
+1
A:
There is a metric ton of examples on the web on this one:
http://aspalliance.com/138
http://www.4guysfromrolla.com/articles/120606-1.aspx
http://www.aspfree.com/c/a/ASP.NET/Uploading-Images-to-a-Database--C---Part-I/
You should be able to follow any of those to accomplish what you want.
Josh
2010-09-16 13:11:33
A:
Michael Bazos
2010-09-16 13:15:35