I use PHP 4.3.4.
I'm used to programming, but I don't understand the problem here.
It looks like my is_dir() function think every folder is a file.
Let say I have the following directory:
test
test/1 -- Is a directory
test/2.jpg -- Is a file
$fp = opendir('test');
while ($file = readdir($fp)){
if ( $file != '.' && $file != '..' && !is_dir($file) ){
echo $file;
}
}
This will output no results.
$fp = opendir('test');
while ($file = readdir($fp)){
if ( $file != '.' && $file != '..' && is_dir($file) ){
echo $file;
}
}
I just removed the ! before the is_dir, and now it returns the .jpg file AND the directory :/
I also tried with is_file. If I use !is_file, all directorys and files appears. If I use is_file, nothing appears.
I'm used to programming, but I don't understand the problem here.
It looks like my is_dir() function think every folder is a file.
Let say I have the following directory:
test
test/1 -- Is a directory
test/2.jpg -- Is a file
$fp = opendir('test');
while ($file = readdir($fp)){
if ( $file != '.' && $file != '..' && !is_dir($file) ){
echo $file;
}
}
This will output no results.
$fp = opendir('test');
while ($file = readdir($fp)){
if ( $file != '.' && $file != '..' && is_dir($file) ){
echo $file;
}
}
I just removed the ! before the is_dir, and now it returns the .jpg file AND the directory :/
I also tried with is_file. If I use !is_file, all directorys and files appears. If I use is_file, nothing appears.