1

I want to send file to server. While I'm using FileBody, everting works fine

MultipartEntity entity = new MultipartEntity(); 
entity.addPart("file", new FileBody(file)); 
post.setEntity(entity); 
client.execute(post);

But when I tried to use InputStreamBody, file didn't loaded to server

entity.addPart("file", new InputStreamBody(new FileInputStream(file), name) { 
  @Override 
  public long getContentLength() { 
    size; 
  } 
});

So what is the difference ?

And the main question, how to send file with InputStreamBody ? I really need to use it !!

Jim
  • 8,874
  • 16
  • 68
  • 125

0 Answers0