The Slim Framework support forum has moved to http://discourse.slimframework.com. This Tender forum is no longer maintained or monitored.

mkdir

dmassiani's Avatar

dmassiani

15 Jun, 2012 03:59 PM

Hello,

i'm a new slim's user, and i like this framework, it's very usefull.

I have a simple question, i try to make a dir and that's doesn't work.

How can i do that ?

Thanks

  1. Support Staff 1 Posted by Andrew Smith on 16 Jun, 2012 01:00 AM

    Andrew Smith's Avatar

    What did you try doing? can you show a code example please, then we will be able to assist you a bit better.

  2. 2 Posted by dmassiani on 16 Jun, 2012 07:35 AM

    dmassiani's Avatar

    I use mkdir : mkdir('/public/user/dmassiani/'.$client, 0755);
    $client is a simple name like "lipsum"

    I have trying mkdir('/lipsum', 0755) and doesnt work.

    Thanks for help me

  3. 3 Posted by dmassiani on 16 Jun, 2012 08:51 AM

    dmassiani's Avatar

    Well, I'm sorry, i have found the solution, i Have drink a coffee.
    For beginners like me, just delete the first slash like this :
    mkdir('thedir')

  4. Support Staff 4 Posted by Brian Nesbitt on 18 Jun, 2012 12:39 AM

    Brian Nesbitt's Avatar

    This sounds like a PHP question vs a Slim specific question. The PHP documentation for mkdir() is here : http://php.net/manual/en/function.mkdir.php

    If you want to specify the full path to a directory that doesn't exist yet you might need the 3rd parameter set to "true" to create the full directory tree.

    $client = "lipsum"; mkdir('/public/user/dmassiani/'.$client, 0755, true);

    Just doing a mkdir("dirname") will create the directory in the current working directory of the script. In the case of Slim its relative to the index.php file even if you are in an included file in a different directory, like routes/user.php for example.

    Glad you found your answer.

  5. Brian Nesbitt closed this discussion on 29 Jun, 2012 01:15 PM.

Comments are currently closed for this discussion. You can start a new one.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac