RE: [PHP] the curse of the period
| From: | David Freeman | Date: | Tue, 11 Jun 2002 10:33:58 +0000 |
| Subject: | RE: [PHP] the curse of the period | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-101524@lists.php.net to get a copy of this message | ||
> The directory and file name:
> museum/trees/admin/upload2.php
>
> The directory I want to store the uploaded file is:
> museum/landmark/photos/
I've found that if you need more control over directory paths than
something fairly simple then you're often best off just declaring a set
of full paths and using them. For example, I often use a config.php to
setup database connections and the like. If I know I'm going to need to
access files in different directories from different parts of a site
I'll usually add something like:
$server_root = "/home/www/some/web/site";
$web_root = "http://www.some.server";
Then if you need to do an include somewhere you can be sure that
something like this:
Include("$server_root/museum/trees/someinclude.php");
Will work. Equally, referring to a default images directory can be
reliable also by using $web_root.
CYA, Dave