I am a beginner in php my code to create a directory is given below.
<?php
if($_POST["create"])
{
$name=$_POST["newDirCreated"];
$uploaddir = $name;
mkdir($uploaddir,0777);
print "created";
}
?>
But directory is not created using this. If i want create a directory in public_html how can i do it?
mkdir() doesn’t throw an exception when something goes wrong. You have to make your script a little bit more “talkative” to get more information about what’s going on
But remember to make it less talkative (yet handling error conditions) again after debugging. You shouldn’t expose all the inforamtion to arbitrary users…
see also: