Home » Developing U++ » U++ Developers corner » MultipartForm Class for use w/HttpClient
Re: MultipartForm Class for use w/HttpClient [message #28088 is a reply to message #28074] |
Sun, 15 August 2010 03:52 |
jeremy_c
Messages: 175 Registered: August 2007 Location: Ohio, USA
|
Experienced Member |
|
|
I was originally thinking of doing that, however the existing HttpClient doesn't provide a way to generate the url encoded post data either. Right now that's all done externally. For example, say I want to submit a form with name, email and password. Currently you would:
String postData = "name=" + UrlEncode(name) + "&email=" + UrlEncode(email) + "&password=" + UrlEncode(password);
HttpClient http("http://localhost/post.cgi");
http.Post(postData);
http.Execute();
So, I kept w/the same type of synario:
MultiformPost form;
form.Set("name", name);
form.Set("email", email);
form.Set("password", password);
HttpClient http("http://localhost/post.cgi");
http.Post(form.ToString());
http.ContentType(form.GetContentType());
http.Execute();
It's just that a Multipart Form is a more complex post structure than a url encoded post structure. Thus a helper class is just about essential. I did do multipart form uploads before w/o my helper class, but the helper class is a big help
Jeremy
[Updated on: Sun, 15 August 2010 03:55] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Wed May 15 04:01:26 CEST 2024
Total time taken to generate the page: 0.01996 seconds
|