[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libmicrohttpd] How to handle multiple data in POST?

From: Carlos Henrique Júnior
Subject: Re: [libmicrohttpd] How to handle multiple data in POST?
Date: Wed, 5 Jan 2011 00:54:12 -0200

Christian, could you create a fully working example using the key features of a HTTP app?

1. GET parameters
2. POST parameters
3. Receiving files

This example, after created, can be maintained by us, but for me at least, it's not that clear how to implement mainly 2 and 3.


Carlos Júnior <address@hidden>
+55 31 8763-5606
+55 31 3227-1009

On Mon, Dec 27, 2010 at 5:00 AM, Nitesh Bhatia <address@hidden> wrote:
Thanks. I finally figured out to work with multiple posts. I was getting confused with Iterator Method Call because as such there is no loop inside that method :).
And for (2) I was a bit unclear that variable "data" associated with variable "key" is the actual data of that key.

Thanks for your help. Now my code is working is fine.


On Sun, Dec 26, 2010 at 7:29 PM, Christian Grothoff <address@hidden> wrote:
On Thursday, December 23, 2010 10:21:08 pm Nitesh Bhatia wrote:
> Hi
> I am a newbie implementing libmicrohttpd for one of my project. I am
> following the example simplepost.c . I want to extend the same such that my
> form takes two inputs say firstname and lastname and after post it should
> display Hi <firstname> <lastname>. I am unable to understand
> the iterate_post method given in the code.
> I have following two confusions:
> 1. How to process multiple data in POST request?
> 2. In the next following page with text:
> const char *greatingpage =
> "<html><body><h1>Distance =  %s!</center></h1></body></html>";
> Where is is value of %s coming from?
> Could anyone please help me how to proceed?
> Thanks and Regards
> Nitesh

Simply use 'MHD_create_post_processor' and pass a function for the
'MHD_PostDataIterator' which will then be called for each item in the post
request. See 'src/testcurl/daemontest_post.c' for an additional full example
for using the post processor API.

As for (2), you're seeing the

    snprintf (answerstring, MAXANSWERSIZE, greatingpage, data);

call, right?

Happy hacking,


Nitesh Bhatia

"Life is never perfect. It just depends where you draw the line."

reply via email to

[Prev in Thread] Current Thread [Next in Thread]