Modify content_header() to take mime type and nocache

This commit is contained in:
Miles Lott 2001-04-13 05:21:20 +00:00
parent 713272f9d2
commit fb487058fe

View File

@ -221,7 +221,7 @@
} }
// Echo content headers for file downloads // Echo content headers for file downloads
function content_header($fn="") function content_header($fn="",$mime="application/octetstream",$nocache=True)
{ {
if ($fn) if ($fn)
{ {
@ -233,11 +233,17 @@
{ {
$attachment = " attachment;"; $attachment = " attachment;";
} }
// Show this for all
header('Content-disposition:'.$attachment.' filename="'.$fn.'"'); header('Content-disposition:'.$attachment.' filename="'.$fn.'"');
header('Content-type: application/octetstream'); header('Content-type: '.$mime);
if ($nocache)
{
header('Pragma: no-cache'); header('Pragma: no-cache');
header('Expires: 0'); header('Expires: 0');
} }
} }
} }
}
?> ?>