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 Rausch, Software Development, Unix, Mac, Windows
  Numerical Applications, Inc.  509-943-0861   [EMAIL PROTECTED]

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