<?php
require __DIR__.'/../auth.php';
if (!is_admin()) { http_response_code(403); exit; }

$data = json_decode(file_get_contents('php://input'),true);
$file = basename($data['file'] ?? '');

$path = __DIR__.'/../uploads/'.$file;

if ($file && is_file($path)) {
    unlink($path);
    echo 'OK';
} else {
    http_response_code(404);
    echo 'Nicht gefunden';
}
