-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCheckFiles.php
More file actions
26 lines (21 loc) · 938 Bytes
/
CheckFiles.php
File metadata and controls
26 lines (21 loc) · 938 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
<?php
// Numeric array with data that will be displayed in HTML table
$aray = glob('uploads/*.*');
$nr_elm = count($aray); // gets number of elements in $aray
// Create the beginning of HTML table, and of the first row
$html_table = '<table border="1 cellspacing="0" cellpadding="2""><tr>';
$nr_col = 2; // Sets the number of columns
// If the array has elements
if ($nr_elm > 0) {
// Traverse the array with FOR
for($i=0; $i<$nr_elm; $i++) {
$html_table .= '<td>' .$aray[$i]. '</td>'; // adds the value in column in table
$html_table .= '<td><a href="' .$aray[$i]. '" download>download</a>';
$html_table .= '</tr><tr>';
}
}
$html_table .= '</tr></table>'; // ends the last row, and the table
// Delete posible empty row (<tr></tr>) which cand be created after last column
$html_table = str_replace('<tr></tr>', '', $html_table);
echo $html_table; // display the HTML table
?>