/** * Generates the path based on filename * * @param String $filename * @return String the path to save file uploaded */ protected function _genPath($filename) { if ($this->_usePathNameDivision) { $path = Agana_Util_FileHandle::fixPathSeparator($this->_path) . Agana_Util_FileHandle::genFolderNameStructure($filename, $this->_nameDivisionLevels, $this->_nameDivisionCharsByLevel); } else { $path = $this->_path; } $path = Agana_Util_FileHandle::fixPathSeparator($path); return $path; }
public function deleteFile() { $path = Agana_Util_FileHandle::fixPathSeparator($this->getRealPath()); $name = Agana_Util_FileHandle::getFileNameWithoutExtension($this->getImage()->getFile()); $path = preg_replace('/(\\*|\\?|\\[)/', '[$1]', $path); $files = glob($path . $name . '*'); foreach ($files as $file) { unlink($file); } }