public function makeZipFromDir($id) { $archiveName = $this->_uploadPath . md5(uniqid(rand(), true)) . '.zip'; $zip = new ZipArchive(); $zip->open($archiveName, ZIPARCHIVE::CREATE); $path = ''; $this->reformDirectory($id, $path, $zip); $zip->close(); Downloader::setDownload($archiveName, filesize($archiveName), $this->_fileSystem->getDirectory($id)->getVirtualName() . '.zip', 'application/zip'); unlink($archiveName); }