<?php
header('Access-Control-Allow-Origin: *');
header('Content-Type: application/json');

$uploadDir = 'uploads/';
$files = [];

if (is_dir($uploadDir)) {
    $dirFiles = scandir($uploadDir);
    foreach ($dirFiles as $file) {
        if ($file !== '.' && $file !== '..') {
            $files[] = $file;
        }
    }
}

echo json_encode($files);
?>
