I want to check the files in the directory, and I use scandir()and is_file()to test. In this simple code, is_file()return falsefor me. but in the directory I have 3 files.
$files = scandir('uploads/slideShow');
$sfiles = array();
foreach($files as $file) {
if( is_file($file) ) {
$sfiles[] = $file;
}
}
for scandir()with variable $file:
Array
(
[0] => .
[1] => ..
[2] => 6696_930.jpg
[3] => 9_8912141076_L600.jpg
[4] => untitled file.txt
)
result for $sfiles:
Array
(
)
source
share