I'm having difficulties having my script automatically create new directories upon account registration.
My code:
$bloguser=$_POST['bloguser'];
$root = "/accounts/";
if(!is_dir($root.$bloguser, 0777))
mkdir($root.$bloguser, 0777);
if(!is_dir($root.$bloguser."/images", 0777))
mkdir($root.$bloguser."/images", 0777);
if(!is_dir($root.$bloguser."/images/avatar", 0777))
mkdir($root.$bloguser."/images/avatar", 0777);
The problem:
The account registers just fine. However, the is_dir and mkdir are giving me errors:
Warning: Wrong parameter count for is_dir() in...
Warning: mkdir() [function.mkdir]: Unable to access /accounts/TestAccount in...
Warning: Wrong parameter count for is_dir() in...
Warning: mkdir() [function.mkdir]: Unable to access /accounts/TestAccount/images in...
Well, you get the idea.
Things I've tried/Things to know:
- I gave the
accounts
folder in the root those 0777 writing rights, just to make sure the writing rights aren't the problem; - I've tried toying around with the double quotes, such as putting them around the variables;
- I also tried to leave the 0777 stuff out of the checks whether the directory exists: if(!is_dir----
Thanks in advance for your help. :)