- mediaCtxHandleT *ctx = (mediaCtxHandleT*) afb_req_context_get(request);
- AFB_PostCtx *postFileCtx;
- json_object *jresp;
- char *path;
+static void on_uploaded(struct afb_req *prequest, int status)
+{
+ struct afb_req request = afb_req_unstore(prequest);
+ struct afb_arg argfile = afb_req_get(request, "file-upload");
+ char *file = renamed_filename(argfile);
+ if (file != NULL)
+ unlink(file);
+ free(file);
+ if (status)
+ afb_req_fail (request, "failed", "expected file not received");
+ else
+ afb_req_success_f (request, NULL, "uploaded file %s", argfile.value);
+}