title: Replace Old FIle with the New upload File
body: <p>I'm creating a web application in which I have to replace the existed uploaded file with the new file uploaded by the <code>fileupload</code>.</p>
  
  <p>I'm using the following code:</p>
  
  <pre><code>void UploadFile()
      {
          HttpPostedFile PostedFile = Request.Files["FileUploadExcel"];
  
          if (PostedFile != null &amp;&amp; PostedFile.ContentLength &gt; 0)
          {
              MyFile = Path.GetFileName(PostedFile.FileName);
  
              PostedFile.SaveAs(Server.MapPath(Path.Combine("~/Data/", MyFile)));
              Get_Data(MyFile);
          }
          else
          {
              LblMessage.Text = "Missing File";
              LblMessage.Visible = true;
          }
      }
  </code></pre>
  
  <p>Please update the code to replace the existing file with the newly uploaded file.</p>