ASP.NET - storing image in database without using fileupload control

Asked By rocky on 10-Mar-11 12:56 PM
How to store image in database without using upload control. I mean i have an default image file in my server folder. and i want to store that image as defaul in database while any new user registers.
Peter Bromberg replied to rocky on 10-Mar-11 01:24 PM
Just use File.ReadAllBytes on the image file and insert it into the user's row in the table.
dipa ahuja replied to rocky on 10-Mar-11 01:27 PM

when you create new user page, there may be one Image control.. in that set imageurl as ur default image, such as default.jpg..

now when user want to choose any other image , he wil select any image by using image upload button..

but at the time of creating account if user dont want to upload image then this default.jpg will be selected as his/her display pictr.

so in that case when u fire  insert query , there may be a field like "imageurl" in that field if user selected any image then insert that uploaded image, If not then insert default.jpg as user's  imageurl field of table..

hope you get this !
Dilip Sharma replied to rocky on 10-Mar-11 10:41 PM
hi.. u can make a field in database table like

path nvarchar(50);

and direct store this path..
like string pa=image1.imageurl;
store pa in database as normal string