RE: [PHP] the curse of the period

2002-06-11 Thread David Freeman


 > 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



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




Re: [PHP] the curse of the period

2002-06-11 Thread hugh danaher

Thank you Jason,
I'll give it a try.
Hugh

dot dot slash slash Oh what a relief it is!
- Original Message -
From: "Jason Wong" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, June 11, 2002 2:33 AM
Subject: Re: [PHP] the curse of the period


> On Tuesday 11 June 2002 17:04, hugh danaher wrote:
>
> > I have a php page which gets a file upload from the user and attempts to
> > put the file in a remote directory.  It is failing big time with the
> > following warning:
> >
> > Warning: Unable to create '../landmark/photos/8000.jpg': No such file or
> > directory in /home/www/location/museum/trees/admin/upload2.php on line
27
> >
> > 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 tried two dots, three dots and more but have yet to hit upon the
> > combination of dots, slashes or phases of the moon to keep the program
from
> > puking!
> >
> > P.S. The page works if the storage directory is closer.
>
> 'closer' has nothing to do with it!
>
> Easy way: use absolute directory paths.
>
> Harder way: the path is relative to wherever your script which in this
case is
> "museum/trees/admin/", you want to go "museum/landmark/photos/" which is 2
> directories up. Thus "../../landmark/photos/"
>
> --
> Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
> Open Source Software Systems Integrators
> * Web Design & Hosting * Internet & Intranet Applications Development *
>
> /*
> Growing old isn't bad when you consider the alternatives.
> -- Maurice Chevalier
> */
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>


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




Re: [PHP] the curse of the period

2002-06-11 Thread Jason Wong

On Tuesday 11 June 2002 17:04, hugh danaher wrote:

> I have a php page which gets a file upload from the user and attempts to
> put the file in a remote directory.  It is failing big time with the
> following warning:
>
> Warning: Unable to create '../landmark/photos/8000.jpg': No such file or
> directory in /home/www/location/museum/trees/admin/upload2.php on line 27
>
> 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 tried two dots, three dots and more but have yet to hit upon the
> combination of dots, slashes or phases of the moon to keep the program from
> puking!
>
> P.S. The page works if the storage directory is closer.

'closer' has nothing to do with it!

Easy way: use absolute directory paths.

Harder way: the path is relative to wherever your script which in this case is 
"museum/trees/admin/", you want to go "museum/landmark/photos/" which is 2 
directories up. Thus "../../landmark/photos/"

-- 
Jason Wong -> Gremlins Associates -> www.gremlins.com.hk
Open Source Software Systems Integrators
* Web Design & Hosting * Internet & Intranet Applications Development *

/*
Growing old isn't bad when you consider the alternatives.
-- Maurice Chevalier
*/


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