Re: Probem with headers. HELP ME!!!

From: Date: Sun, 04 Feb 2001 03:57:20 +0000
Subject: Re: Probem with headers. HELP ME!!!
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-38066@lists.php.net to get a copy of this message
> I want to make a php script that outputs a file in a secure dir (outside of > web root), this scripts checks the permisions of the user to download the > file, i use phplib, and my probmem is when i call it from a browser the > filename to save is set always to test.php, can i send a header to specify > the name of file to save, or other form to make this. You can send a Content-disposition: header that will make some browsers do the right thing, and for some versions of some browsers you have to make your download URL look like: http://yoursite.com/test.php/whatever.doc?filename=whatever.doc I know that extra whatever.doc in the middle looks real goofy, but the web-server just ignores it, once it finds test.php, and PHP just ignores it, since it just gets $filename, and the browser sees it in front of "?" and says "Oh, this must be a whatever.doc file I need to save." This is, like, a total hack that has nothing to do with specifications, but Microsoft and Netscape are not known for actually following specifications. There may be another header to send for other browsers to get it right. Check around in the PHP code archvies linked from http://php.net/links.php and you'll find some sample code.

« previous php.general (#38066) next »