using mkdir to make directory outside of current one.

Discussion in 'PHP' started by jfontestad, Dec 14, 2008.

  1. #1
    here's the problem. i'm using mkdir to check and see if a folder exists and if not create it and if so add files to it.

    here is the dilemma, up until now i had all of my files just sitting in the root directory ie: / and it would create the folder in /folder/created folder.

    now i have moved all my function, config files to a /includes/config folder.

    the problem i am having is that:

    $newdir = "data/".substr($newfilename, 0, 2); <-- worked when i had all files in root directory

    changed to this in order to create the files in my root directory:

    $newdir = "../../data/".substr($newfilename, 0, 2); <--- doesn't work


    any ideas how to correct this?
     
    jfontestad, Dec 14, 2008 IP
  2. jfontestad

    jfontestad Well-Known Member

    Messages:
    1,236
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    148
    #2
    nvm figured it out.

    thanks.
     
    jfontestad, Dec 14, 2008 IP
  3. MrSteveC

    MrSteveC Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Don't you want to let us know how you did it?
     
    MrSteveC, Dec 14, 2008 IP
  4. jfontestad

    jfontestad Well-Known Member

    Messages:
    1,236
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    148
    #4
    just did a chdir() to the root directory right before the mkdir...
    so it would switch directories to / and then create the folder in data/new_folder

    :)
     
    jfontestad, Dec 15, 2008 IP