Hi.
first u drag file from html controls id as PersonImage put one asp web button in that click event write this-
Int64 intImageSize;
string strImageType;
Stream ImageStream;
intImageSize = PersonImage.PostedFile.ContentLength;
strImageType = PersonImage.PostedFile.ContentType;
ImageStream = PersonImage.PostedFile.InputStream;
byte[,] ImageContent;
int intStatus;
intStatus = ImageStream.Read(ImageContent, 0, intImageSize);
SqlConnection myConnection = new SqlConnection(ConfigurationSettings.AppSettings("ConnectionString"));
SqlCommand myCommand = new SqlCommand("sp_person_isp", myConnection);
myCommand.CommandType = CommandType.StoredProcedure;
SqlParameter prmPersonImage = new SqlParameter("@PersonImage", SqlDbType.Image);
prmPersonImage.Value = ImageContent;
myCommand.Parameters.Add(prmPersonImage);
SqlParameter prmPersonImageType = new SqlParameter("@PersonImageType", SqlDbType.VarChar, 255);
prmPersonImageType.Value = strImageType;
myCommand.Parameters.Add(prmPersonImageType);
try {
myConnection.Open();
myCommand.ExecuteNonQuery();
myConnection.Close();
Response.Write("New person successfully added!");
}
catch (SqlException SQLexc) {
Response.Write(("Insert Failed. Error Details are: " + SQLexc.ToString()));
}