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
Re: MultipartForm Class for use w/HttpClient [message #28082 is a reply to message #28074] Sat, 14 August 2010 21:46 Go to previous messageGo to previous message
jeremy_c is currently offline  jeremy_c
Messages: 175
Registered: August 2007
Location: Ohio, USA
Experienced Member
Simply put the existing HttpClient does not provide the facilities for file uploads via HTTP. It does not support Multipart Form data. It supports the POST format just fine which is suitable for most form data, but when a file upload is required (or even present) then the HttpClient falls short. That's where this class comes into play. It builds the post data for HttpClient.

The example I gave above would produce post data that looks like:

form.GetContentType() returns:

Content-Type:multipart/form-data; boundary=XgBtCfDkTmZlYqMtPcLgFgY


form.ToString() returns:

--XgBtCfDkTmZlYqMtPcLgFgY
Content-Disposition: form-data; name="name"

John Doe
--XgBtCfDkTmZlYqMtPcLgFgY
Content-Disposition: form-data; name="age"

18
--XgBtCfDkTmZlYqMtPcLgFgY
Content-Disposition: form-data; name="bio"; filename="mybio.txt"
Content-Transfer-Encoding: text/plain

Hello World!
I am a person who does not exist but is always used in examples.
--XgBtCfDkTmZlYqMtPcLgFgY
Content-Disposition: form-data; name="avatar"; filename="me.jpg"
Content-Transfer-Encoding: base64

...bunch of data snipped for the posts sake...
--XgBtCfDkTmZlYqMtPcLgFgY--


[Updated on: Sat, 14 August 2010 21:48]

Report message to a moderator

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


Current Time: Thu May 16 23:37:48 CEST 2024

Total time taken to generate the page: 0.03203 seconds