title: Trying to delete image from server
body: <p>Hi i have upload an image on the server and trying to delete it from server but not happening any idea how to achieve it will be appreciated.
  image uploading Code</p>
  
  <pre><code>public void Upload1(object sender, EventArgs e)
  {
      //Extract Image File Name.
      fileName1 = Path.GetFileName(FileUpload1.PostedFile.FileName);
      string extension = Path.GetExtension(fileName1);
  
      if (extension.ToLower() == ".png" || extension.ToLower() == ".jpg")
      {
          string s = DateTime.Now.ToString("yyyyMMddHHmmss");
          //Set the Image File Path.
          fileName1 = s + extension.ToLower();
          filePath1 = "~/Uploads/" + fileName1;
          //Save the Image File in Folder.
          FileUpload1.PostedFile.SaveAs(Server.MapPath(filePath1));
          gvImages1.ImageUrl = "~/Uploads/" + Path.GetFileName(filePath1);
      }
  }
  </code></pre>
  
  <p>Image deleting code from server</p>
  
  <pre><code>public void Delete1(object sender, EventArgs e)
  {
      string delImgPath1 = gvImages1.ImageUrl;        
      if (System.IO.File.Exists(delImgPath1))
      {
          System.IO.File.Delete(delImgPath1);
      }
  }
  </code></pre>
  
  <p>image deleting code not able to delete the code from server .</p>