Posted by Tyno Gendo on 04/10/07 16:23
How do you normally check filetypes? I ended up resorting to
!is_dir($file) as all other calls seem to fail so I had to assume if not
a directory its a file, rather than specifically checking if its a file.
I'm recursing a folder:
<?php
$cat_seq = 1;
$path = "e:\\videos\\$cat_seq";
$dh = opendir($path);
while ($file = readdir($dh)) {
echo filetype($file)."<br />";
if ( !is_dir($file) ) {
echo $file;
}
}
?>
Under windows, I can try is_file(), this always returns "" (nothing),
and if I try filetype($file) (as above on the echo) I can get 'dir' for
directories but get the following for files:
Warning: filetype() [function.filetype]: Lstat failed for <filename>
[Back to original message]
|