note 100597 modified in function.is-dir by danbrown

From: Date: Mon, 25 Oct 2010 23:15:34 +0000
Subject: note 100597 modified in function.is-dir by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-173458@lists.php.net to get a copy of this message
I encoutered an error returning false on a directory, my problem was not a bug, but a bad relative path error inside the script function is_dir(), maybe it can help someone having the same problem. I am using Linux with the folowing structure: /var/www/vhosts/example.com/httpdocs/images/items_images/file1.jpg /var/www/vhosts/example.com/httpdocs/images/items_images/temp <?php /* The folder "temp" will show as directory with the following script: */ $full_path = "/var/www/vhosts/example.com/httpdocs/images/items_images"; if ($handle = opendir("$full_path")) { while (false !== ($file = readdir($handle))) { if(is_dir($full_path."/".$file)) continue; else echo $file; } } ?> <?php /* The folder "temp" will show as a file with the following script: */ $full_path = "/var/www/vhosts/example.com/httpdocs/images/items_images"; if ($handle = opendir("$full_path")) { while (false !== ($file = readdir($handle))) { if(is_dir($file)) continue; else echo $file; } } ?> --was-- I encoutered an error returning false on a directory, my problem was not a bug, but a bad relative path error inside the script function is_dir(), maybe it can help someone having the same problem. I am using Linux with the folowing structure: /var/www/vhosts/test.com/httpdocs/images/items_images/file1.jpg /var/www/vhosts/test.com/httpdocs/images/items_images/temp <?php /* The folder "temp" will show as directory with the following script: */ $full_path = "/var/www/vhosts/test.com/httpdocs/images/items_images"; if ($handle = opendir("$full_path")) { while (false !== ($file = readdir($handle))) { if(is_dir($full_path."/".$file)) continue; else echo $file; } } ?> <?php /* The folder "temp" will show as a file with the following script: */ $full_path = "/var/www/vhosts/test.com/httpdocs/images/items_images"; if ($handle = opendir("$full_path")) { while (false !== ($file = readdir($handle))) { if(is_dir($file)) continue; else echo $file; } } ?> http://php.net/manual/en/function.is-dir.php

« previous php.notes (#173458) next »