Hi all,
I have a script that downloads a file - either excel or msword.
However, although the file opens properly, a load of garbage is displayed.
Why is this? I'm pretty sure it's to do with the headers(since I've been playing with them for the past hour), and I've pretty much followed everything in the manual.
But still for some reason the file, when downloaded, won't display properly.
Here's my header code...
if(isset($_SERVER['HTTP_USER_AGENT']) && preg_match("/MSIE/", $_SERVER['HTTP_USER_AGENT'])) {
// IE Bug in download name workaround
ini_set( 'zlib.output_compression','Off' );
}
header('Content-type: ' . $type);
header("Pragma: public");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header('Content-Disposition: attachment; filename="' . $name . '"');
print($content);
Any ideas?
thanks,
Kevin.