Forum Moderators: coopster
I only need to trap the file name (jpg), not the path and I'm not trying to upload the files or anything - simply allow the user to select one of a number of different image files (they're actually location maps).
Can anyone tell me how to achieve this, please.
this will read jpg's into an array, you will probably need to tweak it a bit but it works
$the_array = Array();
$handle = opendir('/root/path/to/dir');
while (false!== ($file = readdir($handle))) {
if ($file!= "." && $file!= ".." &&!is_dir($file)) {
$namearr = split('\.',$file);
if ($namearr[count($namearr)-1] == 'jpg') $the_array[] = $file;
}
}
closedir($handle);