skipping unwanted files with readdir
Posted: Mon Jul 03, 2006 8:04 am
Pimptastic | Please use
as you can see, i work mostly on a mac...the .DS_Store and ._.DS_Store are not read by the PHP (yeah!)...however, i still get files such as ._0.jpg, ._1.jpg, etc...what am i missing. SHouldn't the $file !="." prevent that?
Pimptastic | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
hi guys...got a q....here is the codeCode: Select all
$menuType=$_GET['menuType'];
$directory="images/$menuType";
$openDir=opendir($directory);
while(false!=($file=readdir($openDir))){
if($file !="." && $file !=".." && $file !=".DS_Store" && $file !="._.DS_Store"){
$files.= "<pict>$file</pict>";
}
}as you can see, i work mostly on a mac...the .DS_Store and ._.DS_Store are not read by the PHP (yeah!)...however, i still get files such as ._0.jpg, ._1.jpg, etc...what am i missing. SHouldn't the $file !="." prevent that?
Pimptastic | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]