Norman Norman - 7 months ago 42
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

Yes, you can pass the recursive parameter as true;

mkdir('images/user/15', 0777, true);