Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4

Thread: File Path

  1. #1
    Regular Coder stevenmw's Avatar
    Join Date
    Jun 2007
    Location
    OK
    Posts
    497
    Thanks
    27
    Thanked 31 Times in 31 Posts

    File Path

    Say I have a file in one directory, and I want to include a file from another directory.

    How would I write the file path?

  • #2
    Senior Coder
    Join Date
    Aug 2006
    Posts
    1,209
    Thanks
    7
    Thanked 268 Times in 267 Posts
    We don't really have enough info to tell you for sure. But if, for example, these two directories are at the top of your site, like this:
    site
    ...../includes
    ...../source

    and you have a file in source that's trying to include a file out of the includes directory, it could be specified as "../includes/otherfile.inc"

    Dave

  • #3
    Regular Coder stevenmw's Avatar
    Join Date
    Jun 2007
    Location
    OK
    Posts
    497
    Thanks
    27
    Thanked 31 Times in 31 Posts
    Ive got a file in my directory like this

    root > directory1 > directory2 > directory3 > file.php

    and I want to include a file that's in a directory like this.

    root > directory1.0 > directory2.0 > file2.php


    How could I do that?

    Are there any good articles anywhere about calling directories like this?

  • #4
    Senior Coder
    Join Date
    Jul 2011
    Posts
    1,226
    Thanks
    3
    Thanked 171 Times in 171 Posts
    Quote Originally Posted by stevenmw View Post
    Ive got a file in my directory like this

    root > directory1 > directory2 > directory3 > file.php

    and I want to include a file that's in a directory like this.

    root > directory1.0 > directory2.0 > file2.php


    How could I do that?

    Are there any good articles anywhere about calling directories like this?
    I don't really understand what the problem is here. If you know the path to the file, just use it in an include() or require() function. There are some php constants that can help you - $_SERVER['DOCUMENT_ROOT'] as an example. Check out the $_SERVER manual on php.net to find the one you want


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •