r3827 sortObjectAddressesAndNames(): move to popup.php, where it belongs
[racktables] / download.php
1 <?php
2 require 'inc/init.php';
3 // purely for renderAccessDenied()
4 require 'inc/interface.php';
5
6 assertUIntArg ('file_id');
7 $pageno = 'file';
8 $tabno = 'download';
9 fixContext();
10 if (!permitted())
11 renderAccessDenied();
12
13 $asattach = (isset ($_REQUEST['asattach']) and $_REQUEST['asattach'] == 'no') ? FALSE : TRUE;
14 $file = getFile($_REQUEST['file_id']);
15 if ($file != NULL)
16 {
17 header("Content-Type: {$file['type']}");
18 header("Content-Length: {$file['size']}");
19 if ($asattach)
20 header("Content-Disposition: attachment; filename={$file['name']}");
21 echo $file['contents'];
22 }
23 ?>