1

ファイルをサーバーに送信したい。FileBody を使用している間、反転は正常に機能します

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

しかし、InputStreamBody を使用しようとすると、ファイルがサーバーにロードされませんでした

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

違いは何ですか?

そして主な質問ですが、InputStreamBody でファイルを送信する方法は? どうしても使いたい!!

4

0 に答える 0