Hi,
I have a page where form data is passed to a php page (just script) to
process the input. This page calls a function to output a file:
function sendFileViaHead er($path, $name) {
$fp = fopen($path . $name, 'r');
header("Cache-Control: ");// leave blank to avoid IE errors
header("Pragma: ");// leave blank to avoid IE errors
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"" . $name .
"\"");
header("Content-length: ".(string)(file size($path . $name)));
fpassthru($fp);
}
The original script then calls a further header that will redirect the
user page to a different (or updated original page):
header('Locatio n: http://www.new.com');
However, only the file is sent. The second header is never called. It
is either one or the other. Never both. How do I get around this (I've
tried buffering - ob_start(), ob_end_flush() to no avail)?
Thanks!
I have a page where form data is passed to a php page (just script) to
process the input. This page calls a function to output a file:
function sendFileViaHead er($path, $name) {
$fp = fopen($path . $name, 'r');
header("Cache-Control: ");// leave blank to avoid IE errors
header("Pragma: ");// leave blank to avoid IE errors
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"" . $name .
"\"");
header("Content-length: ".(string)(file size($path . $name)));
fpassthru($fp);
}
The original script then calls a further header that will redirect the
user page to a different (or updated original page):
header('Locatio n: http://www.new.com');
However, only the file is sent. The second header is never called. It
is either one or the other. Never both. How do I get around this (I've
tried buffering - ob_start(), ob_end_flush() to no avail)?
Thanks!
Comment