Hi,

I have a folder structure as follows,
D(drive)>xampp>htdocs>A>B>C>D

I have the php file which creates the new folder in folder A.

Every time a new person registers on my site, I want to create new folder and sub folder within folder D, like D(drive)>xampp>htdocs>A>B>C>D>E>F

$logPath = 'D:/xampp/htdocs/A/B/C/D/';
mkdir("B/C/D/".$E."/".$F);

the above code gives a following error,
Warning: mkdir() [function.mkdir]: No such file or directory in D:\xampp\htdocs\A\register.php on line 77

However, if i write just this, it works fine

$logPath = 'D:/xampp/htdocs/A/B/C/D/';
mkdir("B/C/D/".$E);

Can anybody out there help me out with this pls?

Thanks
Puvi

If you want to create a folder under some folder then … the parent folder must exist (this isn’t just PHP). You can use is_dir function to determine that you already have created the parent folder (if not create if) and then add subfolders to it.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.