Home » U++ Library support » U++ Library : Other (not classified elsewhere) » HttpClient and File Upload?
Re: HttpClient and File Upload? [message #27783 is a reply to message #27756] |
Tue, 03 August 2010 12:31  |
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
|
|
|
Goto Forum:
Current Time: Tue Aug 26 10:32:39 CEST 2025
Total time taken to generate the page: 0.06399 seconds
|