> 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.



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to