ASP.net upload file, rename if exists
<p>I wrote this:</p>

<pre><code>protected void btnup_Click(object sender, EventArgs e)
{
    if (ASPxUploadControl1.HasFile)
    {
        try
        {
            string filename = Path.GetFileName(ASPxUploadControl1.FileName);
            ASPxUploadControl1.SaveAs(Server.MapPath("upload/") + filename);
            StatusLabel.Text = "Upload status: File uploaded!";
        }
        catch (Exception ex)
        {
            StatusLabel.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
        }
    }
}
</code></pre>

<p>Problem is, if I already have File1.jpg, it will overwrite it if someone else uploads File1.jpg.</p>

<p>What to do here?</p>
