Posted on: 10/11/2012 1:30:01 AM | Views : 335

Hello, I would like to be able to upload an image, but the previous one store inside the database will be deleted. I already settle the store image part, but the delete previous part I am unsure how to do. Any suggestions?
This is my code:
protected void Button1_Click(object sender, EventArgs e) { if (FileUpload1.PostedFile != null && FileUpload1.PostedFile.FileName != "") { byte[] imageSize = new byte [FileUpload1.PostedFile.ContentLength]; HttpPostedFile uploadedImage = FileUpload1.PostedFile; uploadedImage.InputStream.Read (imageSize, 0, (int)FileUpload1.PostedFile.ContentLength); SqlConnection con = new SqlConnection(); con.ConnectionString = ConfigurationManager.ConnectionStrings["Sql"].ConnectionString; SqlCommand cmd = new SqlCommand(); cmd.CommandText = "Inse ...

Go to the complete details ...