diff options
author | Koushik Dutta <koushd@gmail.com> | 2013-04-01 10:43:09 -0700 |
---|---|---|
committer | Koushik Dutta <koushd@gmail.com> | 2013-04-01 10:43:09 -0700 |
commit | a4704e53a4d9706f944420946ca51b502d589c1f (patch) | |
tree | 4d4da65d518f97bc8cb6eb0993d19309a18ce66c /README.md | |
parent | 74c04445341afaad8c548d1774d865cfc61d4fb8 (diff) | |
download | AndroidAsync-a4704e53a4d9706f944420946ca51b502d589c1f.tar.gz AndroidAsync-a4704e53a4d9706f944420946ca51b502d589c1f.tar.bz2 AndroidAsync-a4704e53a4d9706f944420946ca51b502d589c1f.zip |
readme
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 22 |
1 files changed, 22 insertions, 0 deletions
@@ -123,6 +123,28 @@ SocketIOClient.connect(AsyncHttpClient.getDefaultInstance(), "http://192.168.1.2 ```
+### Need to do multipart/form-data uploads? That works too.
+
+```java
+AsyncHttpPost post = new AsyncHttpPost("http://myservercom/postform.html");
+MultipartFormDataBody body = new MultipartFormDataBody();
+body.addFilePart("my-file", new File("/path/to/file.txt");
+body.addStringPart("foo", "bar");
+post.setBody(body);
+
+AsyncHttpClient.getDefaultInstance().execute(post, new StringCallback() {
+ @Override
+ public void onCompleted(Exception e, AsyncHttpResponse source, String result) {
+ if (e != null) {
+ ex.printStackTrace();
+ return;
+ }
+ System.out.println("Server says: " + result);
+ }
+});
+```
+
+
### AndroidAsync also let's you create simple HTTP servers (and websocket servers):
```java
|