Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tag: RELEASE_3_1_2
Fetching contributors…

Cannot retrieve contributors at this time

file 52 lines (41 sloc) 1.102 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
* @author Raj Kissu Rajandran
* @version 1.0
* @package BLOBStreaming
*/

set_time_limit(0);

$filename = isset($_REQUEST['file_path']) ? $_REQUEST['file_path'] : NULL;
$c_type = isset($_REQUEST['c_type']) ? $_REQUEST['c_type'] : NULL;

if (isset($filename) && isset($c_type))
{
$hdrs = get_headers($filename, 1);

if (is_array($hdrs))
$f_size = $hdrs['Content-Length'];

header("Expires: 0");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
header("Content-type: $c_type");
header('Content-length: ' . $f_size);
header("Content-disposition: attachment; filename=" . basename($filename));

$fHnd = fopen($filename, "rb");

if ($fHnd)
{
$pos = 0;
$content = "";

while (!feof($fHnd))
{
$content .= fread($fHnd, $f_size);
$pos = strlen($content);

if ($pos >= $f_size)
break;
}

echo $content;
flush();

fclose($fHnd);
}
}
?>
Something went wrong with that request. Please try again.