ohdang888 Posted March 27, 2008 Share Posted March 27, 2008 my code is below.. I am scanning a folder for all the files in it. There are probabaly close to 20 gif and jpg pictures in that folder, but only the picture "none.jpg" is coming up (which is a real picture, ) but why is only 1 file being shown? Thanks! <?php $file = scandir("gamepic"); foreach($file as $key => $value) { if(is_file($value)) { $total++; // Counter echo "$value<br />\n"; } } echo "<p>Total files: $total</p>"; ?> Link to comment https://forums.phpfreaks.com/topic/98088-scan-directory-acting-werid/ Share on other sites More sharing options...
cooldude832 Posted March 27, 2008 Share Posted March 27, 2008 try using glob <?php echo count(glob("gaempic/*.jpg")); ?> Link to comment https://forums.phpfreaks.com/topic/98088-scan-directory-acting-werid/#findComment-501836 Share on other sites More sharing options...
ohdang888 Posted March 27, 2008 Author Share Posted March 27, 2008 That worked. Thanks! Link to comment https://forums.phpfreaks.com/topic/98088-scan-directory-acting-werid/#findComment-501838 Share on other sites More sharing options...
cooldude832 Posted March 27, 2008 Share Posted March 27, 2008 That worked. Thanks! I am amazed u picked up on my misspelling most people would of pasted it and said "why isn't it working" Link to comment https://forums.phpfreaks.com/topic/98088-scan-directory-acting-werid/#findComment-501839 Share on other sites More sharing options...
ohdang888 Posted March 27, 2008 Author Share Posted March 27, 2008 i look over all the code pople give to try to understand what its doing. But ya, it saves a lot of time too! Link to comment https://forums.phpfreaks.com/topic/98088-scan-directory-acting-werid/#findComment-501852 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.