framework/Mvc/Extensions/Ckfinder/lib/core/connector/php/php5/Utils/FileSystem.php
public static function autoRename( $filePath, $fileName )
    {
      $sFileNameOrginal = $fileName;
      $iCounter = 0;
      while (true)
      {
        $sFilePath = CKFinder_Connector_Utils_FileSystem::combinePaths($filePath, $fileName);
        if ( file_exists($sFilePath) ){
          $iCounter++;
          $fileName = CKFinder_Connector_Utils_FileSystem::getFileNameWithoutExtension($sFileNameOrginal, false) . "(" . $iCounter . ")" . "." .CKFinder_Connector_Utils_FileSystem::getExtension($sFileNameOrginal, false);
        }
        else
        {
          break;
        }
      }
      return $fileName;
    }
public static function autoRename( $filePath, $fileName )
    {
      $sFileNameOrginal = $fileName;
      $iCounter = 0;
      while (true)
      {
        $sFilePath = CKFinder_Connector_Utils_FileSystem::combinePaths($filePath, $fileName);
        if ( file_exists($sFilePath) ){
          $iCounter++;
          $fileName = CKFinder_Connector_Utils_FileSystem::getFileNameWithoutExtension($sFileNameOrginal, false) . "(" . $iCounter . ")" . "." .CKFinder_Connector_Utils_FileSystem::getExtension($sFileNameOrginal, false);
        }
        else
        {
          break;
        }
      }
      return $fileName;
    }
public static function autoRename ( $ filePath , $ fileName ) { $ sFileNameOrginal = $ fileName ; $ iCounter = 0 ; while ( true ) { $ sFilePath = CKFinder_Connector_Utils_FileSystem :: combinePaths ( $ filePath , $ fileName ) ; if ( file_exists ( $ sFilePath ) ) { $ iCounter ++ ; $ fileName = CKFinder_Connector_Utils_FileSystem :: getFileNameWithoutExtension ( $ sFileNameOrginal , false ) . "(" . $ iCounter . ")" . "." . CKFinder_Connector_Utils_FileSystem :: getExtension ( $ sFileNameOrginal , false ) ; } else { break ; } } return $ fileName ; }
Autorename file if previous name is already taken

@param string $filePath
@param string $fileName
@param string $sFileNameOrginal
Autorename file if previous name is already taken