thar
thar

Reputation: 1104

php mkdir, folder name and structure

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

Upvotes: 2

Views: 744

Answers (1)

lexabug
lexabug

Reputation: 316

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

mkdir($_SESSION['username'] . '/folder1/folder2/folder3/folder4/', 0777, true);

Upvotes: 4

Related Questions