Ankita Singh

Ankita Singh

  • NA
  • 159
  • 18.9k

delete image from folder as like database

Mar 9 2018 5:07 AM
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string id = Request.QueryString["id"].ToString();
string photo = Request.QueryString["image1"].ToString();
imgdltdata(id,photo);
}
}
private void imgdltdata(string id, string photo)
{
string qry = "delete from appformtbl where id=" + id + " photo=" + photo + "";
{
string filePath = Server.MapPath("~/Rimage/" + "image1.FileName");
if (System.IO.File.Exists(filePath))
{
System.IO.File.Delete(filePath);
}
}
}
 
my problem:- if i do edit operation and edit image then delete old image from folder and update new image..... i write some code but proble is that when i use breakpoint then string photo got null value there is not coming any value....
 
plz someone help me ... thanking you

Answers (4)