-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
42 lines (38 loc) · 1.35 KB
/
index.php
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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<!DOCTYPE html>
<html>
<head>
<title>Auto Audio</title>
<meta charset="UTF-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<table>
<tr>
<th>Name</th>
<th>Play</th>
</tr>
<?php
$dir = "audios/"; // The folder where the audio files are. Ex. "audios/". Don't forget the / after the folder name.
$files = array();
$dh = opendir($dir);
while (false !== ($filename = readdir($dh)) ) {
if ($filename != "." && $filename != "..") {
$files[] = $filename;
}
}
sort($files, SORT_STRING);
foreach($files as $file){
$filedir = $dir.$file;
$name = pathinfo($file, PATHINFO_FILENAME);
echo "<tr>\n";
echo "<td>$name</td>\n";
echo "<td><audio controls>
<source src=".$filedir." type='audio/mpeg'>
Your browser is not supporting.
</audio></td>\n";
echo "</tr>\n";
}
?>
</table>
</body>
</html>