X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=plugins%2Fsamples%2FSamplePost.c;h=1d3069e8a69080758bb10195893f00ffec70bbe7;hb=06382af9092babedbf56aa1c00b3bd7cb0b86cda;hp=6def3b9ce8b8cf92a99d1aab32042a6178c586f4;hpb=3d28e7d00cd8641bf600d47ed0e3e7e57cb5b439;p=src%2Fapp-framework-binder.git diff --git a/plugins/samples/SamplePost.c b/plugins/samples/SamplePost.c index 6def3b9c..1d3069e8 100644 --- a/plugins/samples/SamplePost.c +++ b/plugins/samples/SamplePost.c @@ -1,5 +1,5 @@ /* - * 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"); @@ -18,10 +18,9 @@ #define _GNU_SOURCE #include #include -#include +#include -#include "afb-plugin.h" -#include "afb-req-itf.h" +#include // Sample Generic Ping Debug API @@ -48,7 +47,11 @@ static void GetJsonByPost (struct afb_req request) // 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