Auto Download issues....
Posted: Tue Mar 09, 2010 6:30 am
Hi all,
I'm trying to trigger an auto download of a .zip file which I can do with this code
Trouble is wherever I place it I get errors about cannot modify headers etc.,
How can I display a page with text and graphics which also triggers an auto download
of the zip file ?
Best wishes
Monty
I'm trying to trigger an auto download of a .zip file which I can do with this code
Code: Select all
$filename = "blahblah/bleetbleet.zip";
header("Pragma: public"); // required
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false); // required for certain browsers
header("Content-Type: application/x-zip");
// change, added quotes to allow spaces in filenames, by Rajkumar Singh
header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" );
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($filename));
readfile("$filename");
exit();
Trouble is wherever I place it I get errors about cannot modify headers etc.,
How can I display a page with text and graphics which also triggers an auto download
of the zip file ?
Best wishes
Monty