Thanks to all who offered suggestions.

I have now solved the problem.

Realising that what was actually happening was the offered filename being
the same as the php script name, I built a routine which checks to see if a
script with the desired <filename>.php exists and if not it copies my script
to  a file with that name. This takes place when the page is first loaded,
redirecting to the next page in the web-process (remember that I'm doing all
this with Lasso/Filemaker). The button on that page then calls for the
<filename> script which pushes out the correctly named pdf document to the
user. I have another button which asks for confirmation that the download
was completed satisfactorily and that is used to delete the temporary
<filename>.php script.

This methgod may be of use to someone else. If so, please email me and I'll
share my code.


George P in Edinburgh and looking forward to Frankfurt next week

----- Original Message -----
From: "Bill Rausch" <[EMAIL PROTECTED]>
Sent: Friday, October 19, 2001 8:22 PM
Subject: RE: [PHP] Delivering NAMED pdf files

> George,
> Rasmus' suggestion is correct, but he was terse as usual :) and you
> might not have understood what he was saying.
> My solution is to present a list of the filenames available as LINKS
> (to non-existent files). Then the script does what you've already
> got.  The problem is that some browsers "cheat" and ignore the
> filename that you send in the headers "because they think they know
> better" because of the URL that is currently active. So you fool them
> by making a fake URL.
> In my case I have links that look like:
> <a href="/dl.php/file.pdf">file.pdf</a>
> and my dl.php script looks something like:
> ...
> $uri = urldecode(substr($REQUEST_URI,8));       # skip over the /dl.php/
> $x = strpos( $uri, "?" ); # get rid of trailing SID, etc.
> if( $x > 0 )
>      $uri = substr($uri,0,$x);
> header( ...
> header( ...
> readfile( "$realfileloc/$uri" );
> ...
> Bill
> --
>   Bill Rausch, Software Development, Unix, Mac, Windows
>   Numerical Applications, Inc.  509-943-0861   [EMAIL PROTECTED]

Do You Yahoo!?
Get your free address at

PHP General Mailing List (
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