/*
- * Copyright (C) 2015 "IoT.bzh"
+ * Copyright (C) 2015, 2016 "IoT.bzh"
* Author "Fulup Ar Foll"
*
* Licensed under the Apache License, Version 2.0 (the "License");
#include <string.h>
#include <json-c/json.h>
-#include "afb-plugin.h"
+#include <afb/afb-plugin.h>
// Sample Generic Ping Debug API
// Upload a file and execute a function when upload is done
static void Uploads (struct afb_req request, const char *destination)
{
- afb_req_fail_f(request, "unimplemented", "destination: %s", destination);
+ struct afb_arg a = afb_req_get(request, "file");
+ if (a.value == NULL || *a.value == 0)
+ afb_req_fail(request, "failed", "no file selected");
+ else
+ afb_req_success_f(request, NULL, "uploaded file %s of path %s for destination %s", a.value, a.path, destination);
}
// Upload a file and execute a function when upload is done