Re: How to simultaneously send HTML *and* start download?
| From: | D. D. Brierton | Date: | Tue, 21 May 2002 20:23:46 +0000 |
| Subject: | Re: How to simultaneously send HTML *and* start download? | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-98650@lists.php.net to get a copy of this message | ||
On Tue, 2002-05-21 at 21:02, Billy S Halsey wrote:
> Here's the shell of a script I wrote a while back to do exactly what you
> want:
Thanks, Billy! That's really helpful. I'm curious as to the significance
of the number 12399. Is this just a random number used as a separator,
or does it indicate the length of one of the parts? (In other words
should I alter the boundary marker to reflect the content I'm sending?)
> <?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.
--
======================================================================
D. D. Brierton darren@dzr-web.com www.dzr-web.com
Trying is the first step before failure (Homer Simpson)
======================================================================