Fine...I'll hand hold this one:
// get the contents of the specified directory and save to object
$directory = dir("./yourdir");
// update the table with the updated file information
while ($entry = $directory->read()) {
$file_array['name'] = $entry;
}
You could get even more complex and store all the file details as well into an array like this:
// get the contents of the specified directory and save to object
$directory = dir("./yourdir");
// update the table with the updated file information
while ($entry = $directory->read()) {
$filecount++;
$file_array[$filecount]['name'] = $entry;
$last_fullstop_position = strrpos ($entry, ".");
$file_array[$filecount]['type'] = $type;
$file_array[$filecount]['base'] = substr ($entry, 0, $last_fullstop_position);
if ( $file_array[$filecount]['base'] != ".." || $file_array[$filecount]['base'] != ".") { $file_array[$filecount]['ext'] = substr (strrchr ($entry, "."), 1); } else { $file_array[$filecount]['ext'] = ""; }
$file_array[$filecount]['size'] = filesize("." . $HTTP_GET_VARS['dir'] . "/" . $entry);
$file_array[$filecount]['modified'] = date("Y-m-d G:i:s", filectime("." . $HTTP_GET_VARS['dir'] . "/" . $entry));
$file_array[$filecount]['length'] = strlen ($entry);
}
To get the values from the 'complex' array, use a FOR construct:
for ($i=1; $filecount >= $i; $i++) {
echo $filearray[$i][name];
...
}