protected function getCopyFileName($filePath) { $path = HFile::getDir($filePath); $files = file_exists($path) ? HFile::findFiles($path) : array(); $files = array_flip($files); $ext = HFile::getExtension($this->fileName); $file = HFile::getFileNameByPath($this->fileName, true); $i = 0; $copyFileName = ''; do { $copyFileName = $file . '(' . ++$i . ').' . $ext; } while (array_key_exists($copyFileName, $files)); return $copyFileName; }
public function getName() { return HFile::getFileNameByPath($this->file_path); }