<?php
namespace Engine\Mvc\Response; class FileView extends FileDownload { private $filetype = NULL; public function setFiletype($filetype) { $this->filetype = $filetype; } public function getHeadersFinal() { $headers = parent::getHeadersFinal(); $filetype = $this->filetype; if (!$filetype) { $filetype = \Engine\File::getExtension($this->filename); } $headers->append('Content-Disposition', sprintf('inline; filename="%s";', $this->filename)); switch ($filetype) { case 'pdf': $headers->append("Content-Type", "application/pdf"); break; case 'html': $headers->append("Content-Type", "text/html"); break; case 'mhtml': $headers->append("Content-Type", "message/rfc822"); break; case 'xml': $headers->append("Content-Type", "text/xml"); break; default: $headers->append("Content-Type", "application/octet-stream"); } return $headers; } protected function generateDownloadHeaders() { } } 