Norman Norman - 2 years ago 132
PHP Question

How to tell php to create a directory and another directory inside that one

How do I tell php to create a directory and then another directory inside that directory?

I'm using mkdir here. I have a folder called images. I need to create a folder inside images called 'user', then a folder under user called '15'. I can create the folder called user in one go. How can I do both together?

Answer Source

Yes, you can pass the recursive parameter as true;

mkdir('images/user/15', 0777, true);
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download