RE: [PHP] Re: Generating CSV files on the fly and getting the browser to download
| From: | Dave at Sinewaves.net | Date: | Tue, 10 Sep 2002 09:54:25 +0000 |
| Subject: | RE: [PHP] Re: Generating CSV files on the fly and getting the browser to download | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-115838@lists.php.net to get a copy of this message | ||
try making the generated csv file an attachment to the php file... like
so...
<?php
$fileextension="csv";
$filename="report";
$fnsave = "$filename.$fileextension";
header("Content-type: application/force-download");
header("Content-disposition: attachment; filename=$fnsave");
echo '1,2,3,4,5,6,7,8';
?>
usually works for me.
incidentally, what browser version are you using? on what os?
dave
-----Original Message-----
From: Henry [mailto:henry@teacake.f9.co.uk]
Sent: Tuesday, September 10, 2002 2:43 AM
To: php-general@lists.php.net
Subject: [PHP] Re: Generating CSV files on the fly and getting the
browser to download
It didn'ti work ;-(
Just showed a page with the data in!
How would I do it with a file in any case?
Henry
"Lallous" <phplist@lgwm.org> wrote in message
news:20020910091651.68352.qmail@pb1.pair.com...
> Try this:
>
> <?php
> $fileextension="csv";
> $filename="report";
> $fnsave = "$filename.$fileextension";
>
> header("Content-disposition: filename=$fnsave");
> header("Content-type: application/force-download");
>
> // generate your CSV content here and print them to the browser via ECHO
> echo 'a,b,c,d,1';
> //.........................
>
> ?>
>
> Elias
>
> "Henry" <henry@teacake.f9.co.uk> wrote in message
> news:20020910090639.61998.qmail@pb1.pair.com...
> > Hi All,
> >
> > I suspect this is a commonly asked question but; how do I generate a CSV
> > files on the fly and get the browser to download it.
> >
> > Do I actually need to generate a file or can I just generate a variable
> > contain the data that would be in the file?
> >
> > Any help is greatly appreciated.
> >
> > TIA
> >
> > Henry
> >
> >
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php