is_file suddenly not working after new server migration...

Switching to a new ISP and going from php 4.3 to 5.xx which should be an issue but this section of code which is supposed to read a directory, validate the file type as a jpg image file and then push it into an array, will not get past the first IF statement. I have echo in strategic locations to check progress and the only thing working is the WHILE loop!
This script works just fine on the other server. Any ideas.

[code] while (($file = readdir($dp)) !== false) {
echo ‘
’.$file;
if (is_file($file) && $file!="." && $file!="…"){
echo “filename: " . $file . " is qualified file
”;
list ($tn) = split (’_’, $file);
echo $tn.‘echoed TN
’; ;
If ($tn!=“tn”){
$extention = explode(".",$file);
echo $extention;
$extfield = count($extention)-1;
echo $extfield;
$extention = $extention[$extfield];
echo $extention;
if( in_array($extention,$typelist) ){
array_push ($imagelist,$file);
$_SESSION[‘picturelist’][$j] = $file;
echo ‘photo in array 2’;

  ++$j;       echo $j;  }
                echo 'photo in array 3';

}

}[/code]

I changed it to isfile(); and it works. http://php.net/manual/en/directoryiterator.isfile.php

NOT SO FAST! IT JUST CLEARED UP A LOAD OF OTHER ERRORS.

Have you checked your file permissions?

Sponsor our Newsletter | Privacy Policy | Terms of Service