From 07882614bfd402132d2f8df23cc23c2c013b5f14 Mon Sep 17 00:00:00 2001 From: deva Date: Sat, 11 Oct 2008 10:55:28 +0000 Subject: Did a lot of work on the imagecache, and the filehandler. Now both are functional, and used indirectly throught index.php, thus requiering login for access. --- forum/utils/file.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 forum/utils/file.php (limited to 'forum/utils/file.php') diff --git a/forum/utils/file.php b/forum/utils/file.php new file mode 100644 index 0000000..50993b5 --- /dev/null +++ b/forum/utils/file.php @@ -0,0 +1,31 @@ +getFile($fid); + + $filename = $PERMSTORE . "/" . $file->fid; + + $download = false; + foreach($MIME_TYPES as $m) { + if($m->name == $file->mimetype) $download = !$m->show; + } + + //header ("Cache-Control: must-revalidate, post-check=0, pre-check=0"); + header('Content-Description: File Transfer'); + header('Content-Type: ' . $file->mimetype); + header('Content-Length: ' . filesize($filename)); + + if($download) header('Content-Disposition: attachment; filename=' . basename($file->name)); + else header('Content-Disposition: inline; filename=' . basename($file->name)); + + readfile($filename); +} + +?> \ No newline at end of file -- cgit v1.2.3