loadFromRequest(); if (!isset($_GET['file']) || $_GET['file'] == '') { throw new Exception_Input('File name missing'); } $file = $repo->getFileByName($_GET['file']); $mimetype = $file->getMimeType(); if ($mimetype === null) { $mimetype = 'text/plain'; } header('Content-Type: ' . $mimetype); if ($repo->hash === null) { //IIRC readfile is not so memory-intensive for big files readfile($file->getFullPath()); } else { echo $file->getContent(); } ?>