2

I need to make an new folder on my server, and this also works just fine using mkdir()

But can someone tell me how to make both folder name and structure using mkdir()??

Folder name will be = $_SESSION['username'];

and structure inside the new folder should be = /folder1/folder2/folder3/folder4/

Thanks for your time.

/thar

3
  • possible duplicate of Create file and folders recursively Commented May 18, 2012 at 8:39
  • how should the folderstructure and the username play together? Commented May 18, 2012 at 8:39
  • Some people who probably knows the answer doubt to answer because of that 0%. Commented May 18, 2012 at 8:43

1 Answer 1

4

You need to set third argument to true which allows you creation of nested directories:

mkdir($_SESSION['username'] . '/folder1/folder2/folder3/folder4/', 0777, true);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.