Ankita Singh

Ankita Singh

  • NA
  • 159
  • 19.2k

image delete from folder in edit opreation

Feb 25 2018 10:51 AM
in edit opreation when click update image then delete old image from folder like database....
 
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
string id = Request.QueryString["id"].ToString();
string photo = Request.QueryString["image1"].ToString();
editdata(id);
LoadImage(id);
imgdltdata(id,photo);
}
}
private void imgdltdata(string id, string photo)
{
string qry = "delete from appformtbl where photo=" + photo + " id=" + id + "";
System.IO.File.Delete(image1.PostedFile.FileName);
}
 
this is my code.....
 
i got error Object reference not set to an instance of an object.
 
in string photo.....
 
plz someone help me......

Answers (2)