Skip to main content

Posts

Showing posts with the label upload image through code

Upload Image using code using c sharp dot net

This is example of c#.net code to Upload Image through image upload control and save image to table of database. using System.Data; using System.Data.SqlClient; public partial class ImageUpload : System.Web.UI.Page {     SqlConnection sqlcon=new SqlConnection(@"Server=SQLEXPRESS;database=abc;uid=xxxx;pwd=yyyy;");     SqlCommand sqlcmd=new SqlCommand();     String ImageName,ImageType;     protected void Button1_Click(object sender, EventArgs e)     {         if (FileUpload1.HasFile)         {             int len = FileUpload1.PostedFile.ContentLength;             byte[] picture = new byte[len];             ImageName = FileUpload1.FileName;     ...