Page 1 of 1

Load page before download triggers ?

Posted: Mon Mar 08, 2010 3:03 pm
by MiniMonty
Hi all,

I'm trying to build a page that triggers an automatic download of a zip file.
I'm using this:

Code: Select all

 
<?php
 
/////  TRIGGER THE DOWNLOAD
 
    $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");
    header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" );
    header("Content-Transfer-Encoding: binary");
    header("Content-Length: ".filesize($filename));
    readfile("$filename");  
    exit();
    ?>
 
 
Trouble is, I need to display a message to the user on the page and I can't seem to figure out how to.

How can I force the page (which is just text and basic graphics) to load before the download starts ?

(any other cool solutions much appreciated) !

Best wishes
Monty