aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/samples
diff options
context:
space:
mode:
authorFulup Ar Foll <fulup@iot.bzh>2016-01-26 16:35:37 +0100
committerFulup Ar Foll <fulup@iot.bzh>2016-01-26 16:35:37 +0100
commitd5836c2c45c63cb627d1a72591e1f47f8e229aad (patch)
treeb2c49556eca9f0dc29d9364e71d7f95864465a65 /plugins/samples
parentf1a75365067fb89dd293aa2c8e003c3b041a3c9a (diff)
fixe getPostPath for afm-mail plugin
Diffstat (limited to 'plugins/samples')
-rw-r--r--plugins/samples/SamplePost.c17
1 files changed, 6 insertions, 11 deletions
diff --git a/plugins/samples/SamplePost.c b/plugins/samples/SamplePost.c
index e419be45..88949736 100644
--- a/plugins/samples/SamplePost.c
+++ b/plugins/samples/SamplePost.c
@@ -72,17 +72,12 @@ STATIC json_object* UploadImage (AFB_request *request, AFB_PostItem *item) {
char *destination = "images";
// This is called after PostForm and then after DonePostForm
- if (item == NULL) {
- AFB_PostCtx *postFileCtx = getPostContext(request);
-
- // if postFileCtx == NULL then an error happen [getPostedFile automatically reports errors]
- if (postFileCtx != NULL) {
- // Do something with your newly upload filepath=postFileCtx->path
- request->errcode = MHD_HTTP_OK;
- request->jresp = jsonNewMessage(AFB_FAIL,"UploadFile Post Image done");
-
- // Note: should not return here in order getPostedFile to clear Post resources.
- }
+ if (item == NULL && getPostPath (request) != NULL) {
+ // Do something with your newly upload filepath=postFileCtx->path
+ request->errcode = MHD_HTTP_OK;
+ request->jresp = jsonNewMessage(AFB_SUCCESS,"UploadFile Post Image done");
+
+ // Note: should not return here in order getPostedFile to clear Post resources.
}
// upload multi iteration logic is handle by getPostedFile