Posted by Mark C on 10/10/29 11:24
> Mark C wrote:
> > I admit the subject is a bit of an oxymoron. Here is what I want to
> > do:
> >
> > I want to build a CSV file in a variable and then redirect the
> > browser to the contents of the variable so the user can download the
> > "file" or open it in Excel. I don't want to create a real file so I
> > can avoid cleaning up files after they are used.
>
>"Janwillem Borleffs" <jw@jwscripts.com>
>
> Just redirect to a file which gathers the data and sends the apprioriate
> headers to the browser to trigger the download dialogue.
>
> Example:
>
> // download.php
> <?php
>
> // Headers to start the download; note that a timestamp is used
> // as the file name to prevent caching
> header('Content-Type: x-download');
> header('Content-Disposition: attachment; filename="' . time() . '.csv"');
>
Yes, but won't this create a file that I will have to clean up. I'm
looking for a way to completely avoid the file.
Navigation:
[Reply to this message]
|