note 52617 added to function.is-file

From: Date: Sat, 07 May 2005 06:23:30 +0000
Subject: note 52617 added to function.is-file
Groups: php.notes 
Request: Send a blank email to php-notes+get-89051@lists.php.net to get a copy of this message
After working several hours with some code I realized that the functions is_dir, is_file, file_exists, doesn't seem to work if those files aren't on the same folder as the code is. ie: <?php if (!isset($dir)){ $dir="."; } $recurso=opendir($dir); while ($archivo=readdir($recurso)){ if (is_dir($archivo)){ echo "el elemento $archivo es un directorio<br>"; } if (is_file($archivo)){ echo "el elemento $archivo es un archivo<br>"; } } closedir($recurso); ?> let's say this code is in folder ./home/, well this code will only work as desired for files inside folder ./home , if i use it to read folder ./home/some it will only read work fine with files that are common to both folders. Wating for any suggestion to my mail listed above... ---- Manual Page -- http://www.php.net/manual/en/function.is-file.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+52617 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52617&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52617&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52617&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52617&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52617&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+52617&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#89051) next »