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 » U++ Library support » U++ Library : Other (not classified elsewhere) » HttpClient and File Upload?
HttpClient and File Upload? [message #27756] Mon, 02 August 2010 05:01 Go to next message
jeremy_c is currently offline  jeremy_c
Messages: 175
Registered: August 2007
Location: Ohio, USA
Experienced Member
I am curious if anyone has an example on how to accomplish a file upload with HttpClient?

Thanks,

Jeremy
Re: HttpClient and File Upload? [message #27783 is a reply to message #27756] Tue, 03 August 2010 12:31 Go to previous message
jeremy_c is currently offline  jeremy_c
Messages: 175
Registered: August 2007
Location: Ohio, USA
Experienced Member
Here is a very rough example. This is all hard coded, so should only be used as a point to go ahead and make something more abstract. It does work.

String boundary = "BbX8c0";
HttpClient c("http://localhost/upload");
c.ContentType("multipart/form-data; boundary=" + boundary);
		
StringBuffer b;
b.Cat("--" + boundary + "\r\n");
b.Cat("Content-Disposition: form-data; name=\"Filename\"; filename=\"file.txt\"\r\n\r\n");
b.Cat(adif.ToString());
b.Cat("\r\n--" + boundary + "--\r\n");
		
String pd = (String) b;
c.Post(pd);
String result = c.Execute();
LOG(result);


Jeremy
Previous Topic: v8 JavaScript: Hello World
Next Topic: How about vfw.h, alibrary for video application in windows?
Goto Forum:
  


Current Time: Fri Mar 29 16:17:28 CET 2024

Total time taken to generate the page: 0.01327 seconds