Click here to Skip to main content
15,885,757 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have one Employee table in sql database, I want to add Employee Image in the table using FileUpload Control and then display that image in gridview. So how can i achive this. Plz help.
Posted

Try this link, works fine.

http://forums.asp.net/t/1922364.aspx[^]

If you wanna store the image file in web server and save the image path in Db you can prefer this link
http://www.aspsnippets.com/Articles/Retrieve-images-using-a-file-path-stored-in-database-in-ASPNet.aspx[^]


Its better to store the images in web server instead of SQL server and save the file path in table column, if you are handling more number of images,
in case of less number of images you can save the image object in the SQL Server.
 
Share this answer
 
Make the field datatype of your SQL table as Binary because your going to store large file i.e. BLOB (Binary Large Object)
 
Share this answer
 
thank you friends i solved it.
 
Share this answer
 
Comments
Tom Marvolo Riddle 10-Jan-14 1:11am    
You are very welcome Jignesh Ravel.Use Have a Question or comment? to reply
there is datatype varbinary just use it and make one folder in your applicaton
take fileupload control from toolbox

if (FileUpload2.HasFile)
{
FileUpload2.SaveAs(Server.MapPath(~/images/) + FileUpload2.FileName);
profile_image.ImageUrl = ~/images/ + FileUpload2.FileName;
imagename.Text = FileUpload2.FileName;

}


on gridview just take this image name from database and image from folder

its solved!
 
Share this answer
 
v2

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