/** * Sends a standard headers for file download * @param BaseFileDownload $file File * @param BaseDownloader $downloader Downloader of the file */ protected function sendStandardFileHeaders(BaseFileDownload $file, BaseDownloader $downloader = null) { $res = Environment::getHttpResponse(); $req = Environment::getHttpRequest(); //FDTools::clearHeaders($res); // Voláno už v FileDownload.php $res->setContentType($file->mimeType, "UTF-8"); $res->setHeader("X-File-Downloader", "File Downloader (http://filedownloader.projekty.mujserver.net)"); if ($downloader !== null) { $res->setHeader("X-FileDownloader-Actual-Script", $downloader->getReflection()->name); } $res->setHeader('Pragma', 'public'); // Fix for IE - Content-Disposition $res->setHeader('Content-Disposition', $file->getContentDisposition() . '; filename="' . FDTools::getContentDispositionHeaderData($file->transferFileName) . '"'); $res->setHeader('Content-Description', 'File Transfer'); $res->setHeader('Content-Transfer-Encoding', 'binary'); $res->setHeader('Connection', 'close'); $res->setHeader('ETag', FDTools::getETag($file->sourceFile)); $res->setHeader('Content-Length', FDTools::filesize($file->sourceFile)); // Cache control if ($file->enableBrowserCache) { $this->setupCacheHeaders($file); } else { $this->setupNonCacheHeaders($file); } }
/** * Getts file size * @return float */ public function getSourceFileSize() { return FDTools::filesize($this->sourceFile); }