Just attach your PHP code responsible for the filename / size etc. For example, this is mine (on my own code). Yours will be similar. No need for extra tables, we just check the string on the filename array key, and detect filetype with 1 of 3 ways (i prefer substr() method)
Are you using PHP 8? If you are, then we can use
str_contains()
// Determine torrent icon by file extension - PHP 8
$filetype_icon = '';
if (str_contains($file['path'][0], 'mp3')) {
$filetype_icon = 'somemusicicon.png';
} else if (str_contains($file['path'][0], 'mp4')) {
$filetype_icon = 'somemovieicon.png';
} else if (str_contains($file['path'][0], 'avi')) {
$filetype_icon = 'somemusicicon2.png';
}
and save a lot of time. Otherwise we need to use:
$filetypecheck = substr($fileinfo, 0, strpos($fileinfo, '.'))
if ($filetypecheck !== false && $filetypecheck == 'mp3') {
$filetype_icon = 'somemusicicon.png';
}else if ($filetypecheck !== false && $filetypecheck == 'mp4') {
$filetype_icon = 'somemovieicon.png';
}else if ($filetypecheck !== false && $filetypecheck == 'avi') {
$filetype_icon = 'somemovieicon2.png';
}
The rundown
print("<table align='center' cellpadding='0' cellspacing='0' border='0' width='100%'><tr><th class='table_head' align='left'>File</th><th width='50' class='table_head'>Size</th></tr></table>");
if ($arr !== false && array_key_exists('info', $arr)) {
if (array_key_exists('files', $arr['info'])) {
foreach ($arr['info']['files'] as $file) {
if (array_key_exists('path', $file)) {
printf("<span class=\"material-icons\" style=\"color:%s;vertical-align:bottom\">description</span> <span>%s</span>", $color, html_escape(implode('/', $file['path'])));
printf("<br/>");
}
}
} else if (array_key_exists('name', $arr['info'])) {
printf("<span class=\"material-icons\" style=\"color:%s;vertical-align:bottom\">description</span> <span>%s</span>", $color, html_escape($arr['info']['name']));
printf("<br/>");
}
}