<?php
require_once 'classes/root.class.php';

$ajax = new Ajax();

// Upload handler
$ajax->register('upload_file', function () {
    $uploader = new FileUploader('uploads');
    $customName = $_POST['custom_name'] ?? null;
    return $uploader->save('file', $customName);
});

// Add more handlers here
// $ajax->register('do_something', function () { return ['success' => true]; });

$ajax->handle();
