generateFilename(); } if (!is_writable(sys_get_temp_dir())) { throw new sfException("Temporal directory is not writable."); } $zPath = parent::save($file, $fileMode, $create, $dirMode); $zDir = ($this->path ? $this->path : dirname($zPath)).DIRECTORY_SEPARATOR; // directory $zFile = basename($zPath); // filename $xPath = $zDir.str_replace($this->getExtension(), '', $zFile).DIRECTORY_SEPARATOR; try { $zip = new ZipArchive(); $res = $zip->open($zPath); $zip->extractTo($xPath); $zip->close(); @ unlink($zPath); return $xPath; } catch (Exception $e) { @ unlink($zPath); throw new sfException("I can't open the zip file in ".$zPath); } } }