is*() methods now return boolean values;
[phpmyadmin.git] / bs_disp_as_mime_type.php
blob921f5d8850ddfe0cf0045c0af65adac4d4ef1444
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * @author Raj Kissu Rajandran
5 * @version 1.0
6 * @package BLOBStreaming
7 */
9 set_time_limit(0);
11 $filename = isset($_REQUEST['file_path']) ? $_REQUEST['file_path'] : NULL;
12 $c_type = isset($_REQUEST['c_type']) ? $_REQUEST['c_type'] : NULL;
14 if (isset($filename) && isset($c_type))
16 $hdrs = get_headers($filename, 1);
18 if (is_array($hdrs))
19 $f_size = $hdrs['Content-Length'];
21 header("Expires: 0");
22 header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
23 header("Cache-Control: no-store, no-cache, must-revalidate");
24 header("Cache-Control: post-check=0, pre-check=0", false);
25 header("Pragma: no-cache");
26 header("Content-type: $c_type");
27 header('Content-length: ' . $f_size);
28 header("Content-disposition: attachment; filename=" . basename($filename));
30 $fHnd = fopen($filename, "rb");
32 if ($fHnd)
34 $pos = 0;
35 $content = "";
37 while (!feof($fHnd))
39 $content .= fread($fHnd, $f_size);
40 $pos = strlen($content);
42 if ($pos >= $f_size)
43 break;
46 echo $content;
47 flush();
49 fclose($fHnd);