contentType = $contentType; $this->addHeading = $addHeading; $this->directory = $basepath . "/media/"; $this->filename = $this->directory . "/".$filename; $this->id = $id; } public function send(Nette\Http\IRequest $httpRequest, Nette\Http\IResponse $httpResponse) { $httpResponse->setContentType($this->contentType); $attachment = 'attachment'; if (!empty($this->id)) { $attachment .= '; filename="' . $this->id .".ogg" . '"'; } $httpResponse->setHeader('Content-Disposition', $attachment); $httpResponse->setHeader('Content-Length', filesize($this->filename)); readfile($this->filename); } }