A
Anonymous
Guest
I have only got version php4 on server!
I am wanting to have the following script alterd so it only has in the array the list of certain file extentions. say .JPG
can anyone tell me what I should have and where in this script, as i still am not sure how this work just know the script gets files!
thank you in advance for any help.
J
function php4_scandir($dir,$listDirectories=false, $skipDots=true) {
$dirArray = array();
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if (($file != "." && $file != "..") || $skipDots == true) {
if($listDirectories == false) { if(is_dir($file)) { continue; } }
array_push($dirArray,basename($file));
}
}
closedir($handle);
}
return $dirArray;
}
I am wanting to have the following script alterd so it only has in the array the list of certain file extentions. say .JPG
can anyone tell me what I should have and where in this script, as i still am not sure how this work just know the script gets files!
thank you in advance for any help.
J
function php4_scandir($dir,$listDirectories=false, $skipDots=true) {
$dirArray = array();
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if (($file != "." && $file != "..") || $skipDots == true) {
if($listDirectories == false) { if(is_dir($file)) { continue; } }
array_push($dirArray,basename($file));
}
}
closedir($handle);
}
return $dirArray;
}