title: How to know the extension of uploaded file before saving the file
body: <pre><code>     HttpPostedFile file = context.Request.Files[j];
       string fileName = file.FileName;
       string fileExtension = System.IO.Path.GetExtension(filepath + file.FileName);
       if (!string.IsNullOrEmpty(fileName)
       {
          string pathToSave_100 = HttpContext.Current.Server.MapPath(filepath) + fileName + fileExtension;
          if (File.Exists(pathToSave_100))
          {
             File.Delete(pathToSave_100);
             file.SaveAs(pathToSave_100);
          }
          else
          {
             file.SaveAs(pathToSave_100);
          }
       }
  </code></pre>