_OwNeD.YoU_ Posted March 14, 2009 Share Posted March 14, 2009 any way to grab files in a folder a link them for downloading, i need like 5 folders to get the content from Link to comment https://forums.phpfreaks.com/topic/149435-solved-getting-folder-contents/ Share on other sites More sharing options...
ratcateme Posted March 14, 2009 Share Posted March 14, 2009 you can use glob it will give you a array of the files so like this $dirs = array("dir1","dir2"....); foreach($dirs as $dir){ $files = glob($dir ."/*"); foreach($files as $file){ echo "$file </br>"; } } also glob can be used like glob($dir. "/*.txt"); and will only return files ending in .txt Scott, Link to comment https://forums.phpfreaks.com/topic/149435-solved-getting-folder-contents/#findComment-784850 Share on other sites More sharing options...
_OwNeD.YoU_ Posted March 16, 2009 Author Share Posted March 16, 2009 prefect but i need the diffrent folders in diffrent parts of the page how would i go about doing that? thanks alot, brandon Link to comment https://forums.phpfreaks.com/topic/149435-solved-getting-folder-contents/#findComment-786127 Share on other sites More sharing options...
ratcateme Posted March 17, 2009 Share Posted March 17, 2009 //some code //dir list one $files = glob("dir1/*"); foreach($files as $file){ echo "$file </br>"; } // some more code //dir list 2 $files = glob("dir2/*"); foreach($files as $file){ echo "$file </br>"; } Scott. Link to comment https://forums.phpfreaks.com/topic/149435-solved-getting-folder-contents/#findComment-786399 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.