> ----- Original Message ----- > From: "Bob" <[EMAIL PROTECTED]> > To: <[email protected]> > Sent: Monday, December 12, 2005 12:43 AM > Subject: Re: [php-list] Read a file below root > > > >I can read a file below the root directory ok, by using "../../../test.php" > >but was wondering if it could be done without "../../../" so I don't have > >to calculate how many "../"s to use? > > > > Something like $_SERVER['DOCUMENT_ROOT']; then go one lower. > > > > I suppose I could put the calling file's pathinfo into an array and count > > how many directories up it is, but was hoping there maybe an easier way to > > automate it?
--- Patrick Bierans <[EMAIL PROTECTED]> wrote: > Have you tried to start with a slash at start like "/test.php"? > Should point to root. An include() or require() or file() function makes use of the filesystem references. Hence, a /test.php would go to the very top of the filesystem and attempt (and fail) to find the file. What I normally do is find the location of the current path with $_SERVER['DOCUMENT_ROOT'] to see the place in the filesystem where the web space begins. You can use $_SERVER['PHP_SELF'] to get the current page running and extract the path with a function. James _____ James D. Keeline http://www.Keeline.com http://www.Keeline.com/articles http://Stratemeyer.org http://www.Keeline.com/TSCollection http://www.ITeachPHP.com -- Free Computer Classes: Linux, PHP, etc. Fall Semester Begins Sep 7 -- New Classes Start Every Few Weeks. ------------------------ Yahoo! Groups Sponsor --------------------~--> Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life. http://us.click.yahoo.com/KIlPFB/vlQLAA/TtwFAA/HKFolB/TM --------------------------------------------------------------------~-> Community email addresses: Post message: [email protected] Subscribe: [EMAIL PROTECTED] Unsubscribe: [EMAIL PROTECTED] List owner: [EMAIL PROTECTED] Shortcut URL to this page: http://groups.yahoo.com/group/php-list Yahoo! Groups Links <*> To visit your group on the web, go to: http://groups.yahoo.com/group/php-list/ <*> To unsubscribe from this group, send an email to: [EMAIL PROTECTED] <*> Your use of Yahoo! Groups is subject to: http://docs.yahoo.com/info/terms/
