Welcome, Guest
Please Login or Register.    Lost Password?
Example of Image Upload (1 viewing) (1) Guests
Go to bottom Post Reply Favoured: 0
TOPIC: Example of Image Upload
#30
hanusoft (User)
Fresh Boarder
Posts: 5
graphgraph
User Offline Click here to see the profile of this user
www.hanusoftware.com
Example of Image Upload 1 Year, 1 Month ago Karma: 0  
Here we are uploading images in File System and storing path in the data_base_.

http://www.hanusoftware.com

Code (ImageUpload.aspx.cs) :-
private void Button1_Click(_object_ sender, System.EventArgs e)
{
// Here I am uploading images in Images folder of C drive.
int intResult=0;
string strPath = @"c:Images"+Path.GetFileName(File1.PostedFile.FileName);
SqlConnection con = new SqlConnection("server=.;uid=sa;data_base_=pubs;pwd=");
SqlCommand com = new SqlCommand("Insert into Category(name,imagepath) values(@name,@imagepath)",con);
com.Parameters.Add("@name",TextBox1.Text);
com.Parameters.Add("@imagepath",strPath);
con.Open();
intResult = Convert.ToInt32(com.ExecuteNonQuery());
if(intResult != 0)
{
File1.PostedFile.SaveAs(strPath);
Response.Write("Record Inserted.");
}
}




Software Development Company
 
Report to moderator   Logged Logged  
 
  The administrator has disabled public write access.
Go to top Post Reply
Powered by FireBoardget the latest posts directly to your desktop