Merge branch 'master' of github.com:iotbzh/afb-daemon
[src/app-framework-binder.git] / plugins / samples / SamplePost.c
index 13e1ad6..e419be4 100644 (file)
@@ -47,14 +47,10 @@ STATIC json_object* UploadAppli (AFB_request *request, AFB_PostItem *item) {
 
     // This is called after PostForm and then after DonePostForm
     if (item == NULL) {
-        AFB_PostCtx *postFileCtx = getPostContext(request);      
-        if (postFileCtx != NULL) {
-            
-            // Do something intelligent here to install application
-            
-            postFileCtx->errcode = MHD_HTTP_OK;   // or error is something went wrong;   
-            postFileCtx->jresp   = jsonNewMessage(AFB_SUCCESS,"UploadFile Post Appli done");
-        }
+        // Do something intelligent here to install application
+        request->errcode = MHD_HTTP_OK;   // or error is something went wrong;   
+        request->jresp   = jsonNewMessage(AFB_SUCCESS,"UploadFile Post Appli=%s done", getPostPath (request));
+        // Note: should not return here in order getPostedFile to clear Post resources.
     }
     
     // upload multi iteration logic is handle by getPostedFile