Re: downloading files created by PHP

From: Date: Wed, 14 May 2003 16:10:06 +0000
Subject: Re: downloading files created by PHP
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-147604@lists.php.net to get a copy of this message
No, it causes the file to be downloaded and then the user gets to select if they want to save it or open it. Now... header("Location: download_schedule.php?team=$team"); calls the script to build the file. The script opens the DB, selects the games for the team and builds the csv file from the records returned. Then in these lines header("Content-type: application/vnd.ms-excel"); header("Content-disposition: inline; filename=".$teamname."_schedule.xls"); header("Content-Length: " . strlen($content)); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Pragma: public"); echo("$content"); the script tells their browser that it's sending an ms-excel document named $teamname._schedule.xls and sets the Content-Length to the size of the file and echos out the contents of the file which comes out in their browser as an Excel CSV file or they can also save the file via the file download dialog. Very simple stuff... > I'm a little confused. Does it just display the information on the page? > I'm not sure what that header() stuff is doing... > <SNIP>

« previous php.general (#147604) next »