I have the same image control,fileupload control and a buttoni am displaying default image in my image control when form is loaded which is in the images folder in my solution onlyi am saving the image into database using fileupload control which the user selected his photograph.here the situation is some users not interested to give their image,so in this situation i need to save the default image into data base.now i wrote the below code if the user selected a photo through fileupload control.string strConnection = ConfigurationManager.AppSettings["sqlcon"].ToString(); SqlConnection con = new SqlConnection(strConnection); string Strename = TextBox1.Text;if(FileUpload1.HasFile){ Stream ImageStream = FileUpload1.PostedFile.InputStream; int len = FileUpload1.PostedFile.ContentLength; byte[] ImageContent = new byte[len]; ImageStream.Read(ImageContent, 0, len); con.Open(); SqlCommand cmd = new SqlCommand("sp_InsertPhoto", con); cmd.CommandType = CommandType.StoredProcedure; SqlParameter Paramname = new SqlParameter("@ename", SqlDbType.VarChar); Paramname.Value = Strename; cmd.Parameters.Add(Paramname); SqlParameter ParamImg = new SqlParameter("@photoclip_IM", SqlDbType.Image); ParamImg.Value = ImageContent;//sendingn image param value as imagecontent cmd.Parameters.Add(ParamImg); cmd.ExecuteNonQuery(); con.Close();}else{I want this portion of code when user not selected any file from fileupload control, then i need to save the default image which is already displaying in the image control from images folder.}
Please help me out.....