Scott Taylor wrote:
I have the following file: http://domain.com/archive/newsletters/Dec03.pdf

Lovely.


For some reason this works: filesize('archive/newsletters/Dec03.pdf');

Relative path from the current directory. Is your script in the web root?


but this does not: filesize('/archive/newsletters/Dec03.pdf');

Absolute path (i.e. from the root of the filesystem).


nor does this filesize('http://domain.com/archive/newsletters/Dec03.pdf');

The filesize function does not support URLs.


For some reason this works: readfile('http://domain.com/archive/newsletters/Dec03.pdf');

The readfile does support URLs (if the fopen wrappers are on).


but this does not: readfile('/archive/newsletters/Dec03.pdf');

Absolute path (i.e. from the root of the filesystem).


nor does this: readfile('archive/newsletters/Dec03.pdf');

Relative path from the current directory. The script must be in the web root.


Can someone explain this to me?

1) PHP is not a web browser. It usually expects filesystem paths but some function can handle URLs.
2) You haven't said where the script doing this stuff is in relation to the web root. If a filesystem path does not begin with / then it's relative to the current directory (usually the script directory in the case of PHP scripts).


Hope that helps.

--
Stuart

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to