title: Don't overwrite file uploaded through FileUpload control
body: <p>With the following code:</p>
  
  <pre><code>    protected void Button1_Click(object sender, EventArgs e)
      {
          if (FileUpload1.HasFile)
          {
              string fileExt =
                 System.IO.Path.GetExtension(FileUpload1.FileName);
  
              if (fileExt == ".jpg" || fileExt == ".jpeg" || fileExt == ".gif" || fileExt == ".png")
              {
                  try
                  {
                      FileUpload1.SaveAs(Server.MapPath("../uploads/originals/" + FileUpload1.FileName));
                      Label1.Text = "File name: " +
                          FileUpload1.PostedFile.FileName + "&lt;br&gt;" +
                          FileUpload1.PostedFile.ContentLength + " kb&lt;br&gt;" +
                          "Content type: " +
                          FileUpload1.PostedFile.ContentType;
                  }
                  catch (Exception ex)
                  {
                      Label1.Text = "ERROR: " + ex.Message.ToString();
                  }
              }
              else
              {
                  Label1.Text = "Only image files are allowed!";
              }
          }
          else
          {
              Label1.Text = "You have not specified a file.";
          }
  
  
      }
  </code></pre>
  
  <p>I want to make it so that if the file exists it changes the name of it, is there any built in functionality for this?  Classic ASP had a parameter so that when you upload say house.jpg, and then again it would become house(1).jpg etc etc which was useful.</p>