Reputation: 5
I am trying to create a directory on my server. Here is my code for one directory...
$path = "UserIds/";
$di = $path . $userid;
mkdir($di,0777);
It's work fine but here I need another directory. Here is my code...
$dir="$di./".date("Y/m/d");
mkdir($dir,0777);
This does not make the directory. What is wrong?
Upvotes: 0
Views: 153
Reputation: 16304
Use the quotation marks differently:
$dir= $di . "/" . date("Y/m/d");
If you use PHP version > 5.0.0, maybe add a third parameter in your mkdir command: recursive (as pointed out in the php manual):
mkdir($dir, 0777, TRUE);
Upvotes: 2
Reputation: 490233
You need to make it recursive by setting the third argument to TRUE
.
mkdir($dir, 0777, TRUE);
Upvotes: 1