- json_object* jresp;
- appCtx = (appPostCtx*) postHandle->ctx;
-
- // No Post Application Context [something really bad happen]
- if (appCtx == NULL) {
- request->errcode = MHD_HTTP_EXPECTATION_FAILED;
- return(jsonNewMessage(AFB_FAIL,"Error: PostForm no PostContext to free\n"));
- }
-
- // We have a context but last Xform iteration fail.
- if (appCtx->jerror != NULL) {
- request->errcode = MHD_HTTP_EXPECTATION_FAILED;
- jresp = appCtx->jerror; // retrieve previous error from postCtx
- } else jresp = jsonNewMessage(AFB_FAIL,"UploadFile Post Request file=[%s] done", appCtx->path);
-
- // Error or not let's free all resources
- close(appCtx->fd);
- free (appCtx->path);
- free (appCtx);
- return (jresp);
- }
-
- // Make sure it's a valid PostForm request
- if (!request->post && request->post->type != AFB_POST_FORM) {
- appCtx->jerror= jsonNewMessage(AFB_FAIL,"This is not a valid PostForm request\n");
- goto ExitOnError;
- }
-
- // Check this is a file element
- if (item->filename == NULL) {
- appCtx->jerror= jsonNewMessage(AFB_FAIL,"No Filename attached to key=%s\n", item->key);
- goto ExitOnError;
+ // 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.