title: How to delete image from folder
body: <p>When I upload new image, i want to delete previous uploaded image from folder.</p>
  
  <p>Here is my code to upload an image :</p>
  
  <pre><code>try
  {
        string filename = Image1.ImageUrl.Substring(Image1.ImageUrl.IndexOf('/', Image1.ImageUrl.Length));
        if (fileupload.PostedFile.FileName.Length &gt; 0)
        {                        
               filename = Path.GetFileName(fileupload.PostedFile.FileName);
               fileupload.SaveAs(Server.MapPath("~/Images/" + filename));
        }                    
        com.Parameters.AddWithValue("@Image",(filename.Length&gt;0)? "Images/" + filename:string.Empty);
        com.ExecuteNonQuery();                    
  }
  catch (Exception ex)
  {
        btnsub.Text = ex.Message;
  }
  </code></pre>
  
  <p>Here i am saving an image in a Server folder called <strong>Images</strong> using FileUpload, So before i upload a new image , i want to delete the previous uploaded image from the folder.</p>
  
  <p>May I know, how to delete previous uploaded image?</p>