r3959 commitDeleteObject(): revert recent "optimisation", which turned out to break...
[racktables] / download.php
CommitLineData
e1ae3fb4
AD
1<?php
2require 'inc/init.php';
0df8c52b
DO
3// purely for renderAccessDenied()
4require 'inc/interface.php';
e1ae3fb4 5
0cc24e9a 6assertUIntArg ('file_id');
d9731fc4 7$pageno = 'file';
0df8c52b 8$tabno = 'download';
d9731fc4
AD
9fixContext();
10if (!permitted())
0df8c52b 11 renderAccessDenied();
d9731fc4 12
0df8c52b 13$asattach = (isset ($_REQUEST['asattach']) and $_REQUEST['asattach'] == 'no') ? FALSE : TRUE;
e1ae3fb4
AD
14$file = getFile($_REQUEST['file_id']);
15if ($file != NULL)
16{
17 header("Content-Type: {$file['type']}");
18 header("Content-Length: {$file['size']}");
0df8c52b
DO
19 if ($asattach)
20 header("Content-Disposition: attachment; filename={$file['name']}");
e1ae3fb4
AD
21 echo $file['contents'];
22}
23?>