By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,776 Members | 1,380 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,776 IT Pros & Developers. It's quick & easy.

Output file without saving

P: n/a
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?

--
Aaron

Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On 6 May 2005 15:56:50 -0700, AaronV wrote:
It's a form button, that when pressed, prompts the use to download a
file.


See http://php.net/header
--
Firefox Web Browser - Rediscover the web - http://getffox.com/
Thunderbird E-mail and Newsgroups - http://gettbird.com/
Jul 17 '05 #2

P: n/a
AaronV wrote:
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?


You send headers that tell the browser to expect something other than
the normal fare, then stream your dynamic content after. e.g:

<?php
$csv = '"name","age"' . "\n";
$csv .= '"John Doe", 30' . "\n";
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: attachment; filename=simple.csv");
echo $csv;
?>
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.