note 100597 added to function.is-dir
| From: | h_guillaume at hotmail dot com | Date: | Mon, 25 Oct 2010 23:02:41 +0000 |
| Subject: | note 100597 added to function.is-dir | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-173457@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/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;
}
}
?>
----
Server IP: 69.147.83.197
Probable Submitter: 216.246.227.91
----
Manual Page -- http://www.php.net/manual/en/function.is-dir.php
Edit -- https://master.php.net/note/edit/100597
Del: integrated -- https://master.php.net/note/delete/100597/integrated
Del: useless -- https://master.php.net/note/delete/100597/useless
Del: bad code -- https://master.php.net/note/delete/100597/bad+code
Del: spam -- https://master.php.net/note/delete/100597/spam
Del: non-english -- https://master.php.net/note/delete/100597/non-english
Del: in docs -- https://master.php.net/note/delete/100597/in+docs
Del: other reasons-- https://master.php.net/note/delete/100597
Reject -- https://master.php.net/note/reject/100597
Search -- https://master.php.net/manage/user-notes.php