public function getUniqFileName($dir, $name, $sep = '-')
    {
        list($name, $ext) = $this->standardizeFileName($name, true);

        $nameF = $name.'.'.$ext;
        $i = 2;
        while (isset($this->uniqFileNames[$dir.'/'.$nameF]) || file_exists($dir.'/'.$nameF)) {
            $nameF = $name.$sep.$i.'.'.$ext;
            ++$i;
        }
        $this->uniqFileNames[$dir.'/'.$nameF] = true;

        return $nameF;
    }
public function getUniqFileName($dir, $name, $sep = '-')
    {
        list($name, $ext) = $this->standardizeFileName($name, true);

        $nameF = $name.'.'.$ext;
        $i = 2;
        while (isset($this->uniqFileNames[$dir.'/'.$nameF]) || file_exists($dir.'/'.$nameF)) {
            $nameF = $name.$sep.$i.'.'.$ext;
            ++$i;
        }
        $this->uniqFileNames[$dir.'/'.$nameF] = true;

        return $nameF;
    }
public function getUniqFileName ( $ dir , $ name , $ sep = '-' ) { list ( $ name , $ ext ) = $ this -> standardizeFileName ( $ name , true ) ; $ nameF = $ name . '.' . $ ext ; $ i = 2 ; while ( isset ( $ this -> uniqFileNames [ $ dir . '/' . $ nameF ] ) || file_exists ( $ dir . '/' . $ nameF ) ) { $ nameF = $ name . $ sep . $ i . '.' . $ ext ; ++ $ i ; } $ this -> uniqFileNames [ $ dir . '/' . $ nameF ] = true ; return $ nameF ; }
Get a new uniq filename in a directory.

@param string $dir  Destination directory
@param string $name Original filename
@param string $sep  Spearator used in case file already exists

@return string
Get a new uniq filename in a directory .