Advertisement
Guest User

Untitled

a guest
Aug 29th, 2014
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.47 KB | None | 0 0
  1. File file = new File(filepath);
  2.  
  3. HttpClient client = new DefaultHttpClient(); //DefaultHTTPClient is deprecated?
  4. HttpPost post = new HttpPost(url);
  5.  
  6. //Multipart Entity is also deprecated??
  7. MultipartEntity entity = new MultipartEntity();
  8. entity.addPart("file[path]", new FileBody(file));
  9. post.setEntity((HttpEntity) entity);
  10.  
  11. try {
  12. HttpResponse response = client.execute(post);
  13.  
  14. } catch (IOException e) {
  15.  
  16. e.printStackTrace();
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement