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: | <?php
function download_headers($filename) {
$agentstr = getenv('HTTP_USER_AGENT');
if (eregi('opera', $agentstr)) {
$agent = 'OPERA';
} elseif (eregi('msie', $agentstr)) {
$agent = 'IE';
} else {
$agent = 'STD';
}
$mime_type = ($agent == 'IE' || $agent == 'OPERA')
? 'application/octetstream'
: 'application/octet-stream';
header('Content-Type: ' . $mime_type);
if ($agent == 'IE') {
header('Content-Disposition: inline; filename="'.$filename.'"');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
} else {
header('Content-Disposition: attachment; filename="'.$filename.'"');
header('Expires: 0');
header('Pragma: no-cache');
}
}
?> |