private function fileRename() {
    $filename = $this->filename_new;
    $extension = '.' . File::extension($this->filename_new);
    $basename = rtrim($filename, $extension);

    $increment = 0;

    while (File::exists($this->directory . $filename)) {
      $filename = $basename . '_' . ++$increment . $extension;
    }

    return $this->filename_new = $filename;
  }
private function fileRename() {
    $filename = $this->filename_new;
    $extension = '.' . File::extension($this->filename_new);
    $basename = rtrim($filename, $extension);

    $increment = 0;

    while (File::exists($this->directory . $filename)) {
      $filename = $basename . '_' . ++$increment . $extension;
    }

    return $this->filename_new = $filename;
  }
private function fileRename ( ) { $ filename = $ this -> filename_new ; $ extension = '.' . File :: extension ( $ this -> filename_new ) ; $ basename = rtrim ( $ filename , $ extension ) ; $ increment = 0 ; while ( File :: exists ( $ this -> directory . $ filename ) ) { $ filename = $ basename . '_' . ++ $ increment . $ extension ; } return $ this -> filename_new = $ filename ; }
Appends _X to the file's basename if it already exists

@return string
The newly renamed file
Appends _X to the file s basename if it already exists