php create directory
<p>I am creating a directory and I am getting the error </p>

<p>Warning: chmod() [function.chmod]: No such file or directory in /home/www/public_html/console/pubs-add.php on line 104</p>

<p>The php file that is running the code is in www/console and the directory that I am trying to create is in www/images/gallery.</p>

<p>I have tried many variations of setting the path such as ../images/gallery or home/www but nothing seesm to work</p>

<pre><code>define("PATH", "/www/images/gallery");

$dir = 'a1234';

$targetfilename = PATH . '/' . $dir;

if (!is_file($dir) &amp;&amp; !is_dir($dir)) {
    mkdir($dir); //create the directory
    chmod($targetfilename, 0777); //make it writable
}
</code></pre>
