blueimp/jQuery-File-Upload — pull request #3358 by DeveloperKid (2014-09-23 06:44:30+00:00)
Title: Add support for duplicate filenames

Hey guys,

i build myself a solution for duplicate files/filenames on the server.
Works pretty well atm on my machine, maybe have a look at it.

int k = 1;
while (File.Exists(path1 + "\\files\\" + fileInfo.name))
{
if (fileInfo.name.IndexOf("Copy " + (k - 1) + " of ") >= 0)
fileInfo.name = fileInfo.name.Replace("Copy " + (k - 1) + " of ", "Copy " + k + " of ");
else
fileInfo.name = "Copy " + k + " of " + fileInfo.name;
k++;
}