public function executeLogDownload($request) { $filepath = sfConfig::get("app_remote_log_file"); $response = $this->getResponse(); $response->clearHttpHeaders(); $response->setHttpHeader('Content-Length', sprintf("%u", filesize($filepath))); $response->setContentType('application/x-download'); $response->setHttpHeader('Content-Disposition', 'attachment; filename="' . $filepath . '"'); $response->sendHttpHeaders(); ob_end_clean(); $this->getResponse()->setContent(IOFile::readfile_chunked($filepath)); return sfView::NONE; }
public function executeIsoDownload(sfWebRequest $request) { $directory = sfConfig::get("config_isos_dir"); $file = $request->getParameter('file'); $filepath = $directory . "/" . $file; if (dirname($filepath) == $directory) { if ($directory && $file && is_file($filepath)) { $response = $this->getResponse(); $response->clearHttpHeaders(); $response->setHttpHeader('Pragma: public', true); $response->setHttpHeader('Content-Length', sprintf("%u", filesize($filepath))); $response->setContentType('application/x-download'); $response->setHttpHeader('Content-Disposition', 'attachment; filename="' . $file . '"'); $response->sendHttpHeaders(); ob_end_clean(); $this->getResponse()->setContent(IOFile::readfile_chunked($filepath)); } } return sfView::NONE; }