<?php # Pitchfork download script # Accepts the mask of the file (or directory) to download # and however it want's to be downloaded. include 'includes/pitchfork-class-listing.php'; include 'configuration/pitchfork-configuration-user.php'; //include('pitchfork-application-authenticate.php'); $listing = new Listing(); $file_temp = $listing->find_hash($_REQUEST['item'], $Cfg_FolderLoc); $file_path = $file_temp["current_dir"]; if ($file_path) { $file_mime = $listing->get_mime($file_path); //$file_contents = $listing -> get_contents($file_path); $file_bytes = $listing->get_bytes($file_path); # Discover the file name $file_PathArray = explode('/', $file_path); //print_r($file_PathArray); $file_name = end($file_PathArray); if ($_REQUEST['mode'] == "zip") { $file_name .= $Cfg_CompressExt; } # IE Compatability Hack (taken from cvs.moodle.org - so thank's to them) if (ini_get('zlib.output_compression')) { ini_set('zlib.output_compression', 'Off'); } # Do some headers and stuff... header("Accept-Ranges:bytes"); header("Content-Length:" . $file_bytes); header("Content-Type:" . $file_mime); header("Cache-Control: public");