PHP · 380 bytes Raw Blame History
1 <?php
2 // audio/list.php - Optional API endpoint for listing audio files
3 // This provides a cleaner way to get the file list than parsing HTML
4
5 header('Content-Type: application/json');
6 header('Access-Control-Allow-Origin: *');
7
8 // Get all WAV files in the current directory
9 $files = glob('*.wav');
10
11 // Sort alphabetically
12 sort($files);
13
14 // Return as JSON
15 echo json_encode($files);