#include #include void response(magi_request *r) { char *name = magi_request_param(r, "name"); const magi_file *data = magi_request_file(r, "data"); magi_response(r, "" "" "Upload File" ""); if (name && data) { rename("data", name); magi_response(r, "

Uploaded!

"); } magi_response(r, "
" "" "" "" "
" "" ""); } void get(magi_request *r) { magi_loadfiles rules = { 0, 0 }; magi_loadfiles_add(&rules, "data", "data", 0); magi_loadfiles_set(r, &rules); magi_cgi(r); magi_loadfiles_free(&rules); } int main() { magi_request request; magi_request_init(&request); get(&request); if (request.error) { magi_response_error(&request); } else { response(&request); } magi_request_free(&request); return 0; }