Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » Developing U++ » U++ Developers corner » MultipartForm Class for use w/HttpClient
MultipartForm Class for use w/HttpClient [message #28074] Sat, 14 August 2010 17:18 Go to previous message
jeremy_c is currently offline  jeremy_c
Messages: 175
Registered: August 2007
Location: Ohio, USA
Experienced Member
I created a class named MultipartForm that can be used w/Http(s)Client. It allows one to do file uploads. I know this will be of use to others as the question has come up on the forum a few times. What I don't know is the best way to share it or get feedback on it. Here's a sample use:

MultipartForm form;
form.Set("name", "John Doe");
form.Set("age", "18");
form.SetFile("bio", "mybio.txt", LoadFile("mybio.txt"));
form.SetFile("avatar", "me.jpg", Base64Encode(LoadFile("me.jpg")), "base64");

HttpClient http("http://localhost/upload.cgi");
http.ContentType(form.GetContentType());
http.Post(form.ToString());


That's basically it. In the end it creates a properly formatted multipart/form-data submission.

Jeremy
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Plugin Framework
Next Topic: JavaScriptCore
Goto Forum:
  


Current Time: Mon Apr 29 10:29:53 CEST 2024

Total time taken to generate the page: 0.03368 seconds