Re: How to simultaneously send HTML *and* start download?

From: Date: Tue, 21 May 2002 20:02:30 +0000
Subject: Re: How to simultaneously send HTML *and* start download?
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-98645@lists.php.net to get a copy of this message
Hi, Here's the shell of a script I wrote a while back to do exactly what you want: <?php header("Content-Type: multipart/mixed; boundary=\"-Boundary-12399\""); print "---Boundary-12399\r\n"; print "Content-Type: text/html\r\n"; print "\r\n"; // Your HTML code goes here print "\n"; print "---Boundary-12399\r\n"; print "Content-Type: application/octet-stream\r\n"; print "Content-Disposition: attachment; filename=foo.tar.gz\r\n\r\n"; readfile("./foo.tar.gz"); print "---Boundary-12399--\r\n"; print "\r\n"; ?> Note the format of the "Boundary" headers, especially the dashes. /bsh/ -- /---------------------------------------------=[ BILLY S HALSEY ]=--\ | Member of Technical Staff, Sun Microsystems, Inc. ESP Solaris SW | | "All opinions and technical advice offered in this message are my | | own and not necessarily endorsed by my employer." | \--=[ bsh-php@sun.com ]=--------------------------------------------/

« previous php.general (#98645) next »