From: José Bollo Date: Fri, 13 May 2016 09:50:38 +0000 (+0200) Subject: implements the example for file uploading X-Git-Tag: blowfish_2.0.1~120 X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=commitdiff_plain;h=09b02c50df8ae0d87ce7b3e5e092eb93086f5f1e;p=src%2Fapp-framework-binder.git implements the example for file uploading Change-Id: I3171edbb702eecde401a218f8a56cc365aeaadbb Signed-off-by: José Bollo --- diff --git a/plugins/samples/SamplePost.c b/plugins/samples/SamplePost.c index d6c5dec8..cfb0c591 100644 --- a/plugins/samples/SamplePost.c +++ b/plugins/samples/SamplePost.c @@ -47,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_f(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