Cofem/endpoints/upload.php
2024-04-25 15:01:17 +02:00

18 lines
627 B
PHP

<?php
require_once "lib/upload.php";
function endpoint($endpoint_data): array
{
return match ($endpoint_data["action"]) {
"getMyFiles" => listFiles(),
"getAllFiles" => listFiles(false),
"uploadFiles" => parseIncomingFiles(),
"deleteFile" => deleteFile($endpoint_data['file_id']),
"addToGroup" => addToGroup($endpoint_data['group_id'], $endpoint_data['file_id']),
"myFileExists" => fileExists($endpoint_data['file_id'], ),
"FileExists" => fileExists($endpoint_data['file_id'], false),
default => ["Status" => "Fail", "message" => "Invalid action"],
};
}