Renaming file in C# on Server
If you have two simultaneous file uploads db.Pictures.Count(); will return same number. So you will get a name clash.

If db.Pictures is a database then you can create and auto increment identity field and use it to save the file.

If there is no option with database you can use two more approaches:
Use GUID instead of picture name

[HttpPost]
public ActionResult Upload(HttpPostedFileBase fileData)
{
    if (fileData != null &amp;&amp; fileData.ContentLength &gt; 0)
    {
        string extension = Path.GetExtension(fileData.FileName);

        string renamedImage = null;
        do
        {
            renamedImage = Server.MapPath("~/Content/Images/Categories/cat" + System.Guid.NewGuid().ToString("N") + extension);

        } while( /*verify that renamedImage file does not exist*/ );

        fileData.SaveAs(renamedImage);
        return Json(Path.GetFileName(renamedImage));
    }
    return Json(false);
}


The drawback of this approach is that it is possible to upload same pictures to the server.

To mitigate that you can try using hash of the image as a file name. Before writing file contents to the disk check if that file already exists. Note: the check and file save operation must be made in thread-safe manner.