Do you have a question? Post it now! No Registration Necessary. Now with pictures!
- Posted on
- Output file without saving
May 6, 2005, 8:56 pm
rate this thread
I've seen a few sites that offer this, but I'm not sure how they do it.
It's a form button, that when pressed, prompts the use to download a
file. Like if I want my banking records, I select a date range and
press the button, and it compiles and sends me an excel doc right then.
What I'd like is to comile and deliver a file in that manner, without
saving the file to some directory and providing a link. Does anyone
know how this is done?
Re: Output file without saving
You send headers that tell the browser to expect something other than
the normal fare, then stream your dynamic content after. e.g:
$csv = '"name","age"' . "\n";
$csv .= '"John Doe", 30' . "\n";
header("Content-disposition: attachment; filename=simple.csv");