How do I properly auto append to filename if file exist
<p>Here is what I have tried, please note that <code>lblImageAlt.Text</code> property has been set to <code>'Images/'</code></p>

<pre><code>        string ImgPath1 = lblImageAlt1.Text.ToString();
        string ImgPath2 = lblImageAlt2.Text.ToString();
        string ImgPath3 = lblImageAlt3.Text.ToString();

        string filename1 = "";
        string filename2 = "";
        string filename3 = "";


        if (fileuploadimages1.HasFile)
        {
            if (File.Exists(Server.MapPath(ImgPath1 + filename1)))
            {
                string extension = Path.GetExtension(filename1);
                string name = Path.GetFileNameWithoutExtension(filename1);
                int fileMatchCount = 1;
                while (File.Exists(Server.MapPath(ImgPath1 + name + "(" + fileMatchCount + ")" + extension)))
                    fileMatchCount++;

                fileuploadimages1.SaveAs(Server.MapPath(ImgPath1 + name + "(" + fileMatchCount + ")" + extension));
            }
            else
            {
                fileuploadimages1.SaveAs(Server.MapPath(ImgPath1 + filename1));
            }
        }
        else
        {
            filename1 = "noImage.jpg";
        }
</code></pre>

<p>but the same image does not get a number appended to it. What am I doing wrong here?</p>
