Re: creating a file to be downloaded by user

From: Date: Thu, 22 May 2003 16:16:51 +0000
Subject: Re: creating a file to be downloaded by user
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-148573@lists.php.net to get a copy of this message
On Friday 23 May 2003 00:01, Amanda McComb wrote: > I removed white space from database.php and no longer have errors, but it > still isn't doing what I expected. I expected that a file would be > created, and I can't seem to find the file. Nowhere in your code have you created a file. > I'm confused on how to export or download a file in PHP. Are there any > good examples that explain how to do this? > > header("Content-type: application/vnd.ms-excel"); > > header("Content-disposition: inline; > > filename=test_schedule.xls"); > > header("Content-Length: " . strlen($content)); > > header("Cache-Control: must-revalidate, post-check=0, > > pre-check=0"); > > header("Pragma: public"); > > echo("$content"); > > } > > } > > ?> Your subject says "creating a file to be downloaded by user", if you really mean that then your headers are incorrect. Search the archives for the correct headers to use. -- Jason Wong -> Gremlins Associates -> www.gremlins.biz Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * ------------------------------------------ Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general ------------------------------------------ /* A clash of doctrine is not a disaster -- it is an opportunity. */

« previous php.general (#148573) next »