Click here to Skip to main content
15,898,939 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Pls some one tell that how to take fileupload values in parameters add with value my code for text box is but i dont know for the fileupload control for imgae my code is
C#
cmd.Parameters.AddWithValue("@Address", ((TextBox)(e.Item.FindControl("Tb_eaddress"))).Text);
cmd.Parameters.AddWithValue("@image", ((FileUpload)(e.Item.FindControl("Fup_load1"))).Text);

i am able to text box value but for image fileupload control i am not able pls tell....
Posted
Updated 16-Aug-12 2:11am
v2
Comments
I.explore.code 16-Aug-12 6:21am    
what exactly do you want to store, the name of the image file in the FileUpload box or actual image?
ZurdoDev 16-Aug-12 8:12am    
The way I normally do it is save the image to the file system and then just write the image path to the database. It makes linking and other things a lot easier. Are you trying to write the image binary to the database or just the image path?
I.explore.code 16-Aug-12 11:11am    
i use it too but i realised that this way is too cumbersome you always have a risk of name mismatch screwing things up so i would suggest storing the image bytes as varbinary in SQL server and then using inbuilt imaging namespace, render it if you want to or write it out to a file to download. But that's just me.

1 solution

hi,

you have to use filename property instead of text property.

cmd.Parameters.AddWithValue("@image", ((FileUpload)(e.Item.FindControl("Fup_load1"))).FileName);

thanks.
 
Share this answer
 

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