This isn't really a cake question I guess... but I cannot find the
answer and this group has a bunch of smart cookies.
How do I get the browser to prompt the user to download a file AFTER
HTML has been rendered? I see it on some websites like file planet I
believe. I am thinking it it done with AJAX? Maybe render the page
then make an AJAX call to another PHP script that sends different
headers?
Any pointers to information would be great! In the mean time, I will
keep scouring the web.
This is what I have at the moment. Even if I comment out the layout
and/or the render part, I still don't get the HTML page and then the
file prompt. Maybe I just don't understand the way headers work well
enough?
if(isset($this->zipinfo)){
header('Pragma: public');
header('Content-type: application/zip');
header('Content-length: ' .
filesize($this->zipinfo['zippath'].
$this->zipinfo['zipname']));
header("Content-Transfer-Encoding: binary");
header('Content-Disposition: attachment;
filename="'.$this-
>zipinfo['zipname'].'"');
readfile($this->zipinfo['zippath'].$this->zipinfo['zipname']);
//$this->layout = 'ajax';
//$this->autoRender=false;
exit();
}
Thanks.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Cake
PHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---