One method is to use folder functions such opendir, readdir etc.
Here is a function that returns the contents of a folder in an array:
<?php function get_folder_contents($folder) { if(!is_dir($folder)) { return array(); /* You might want to do something more useful here */ } $return_array = array(); if ($dh = opendir($folder)) { while (($file = readdir($dh)) !== false) { if($file == '.' || $file == '..') continue; $return_array[] = $folder .$file; } closedir($dh); } return $return_array; } ?>
I'm the co-founder of
No comments yet.
RSS feed for comments on this post. TrackBack URL