这是我到目前为止的内容:
multipartentity reqEntity = new multipartentity();
String strXMLFilename = "/sdcard/image.gif";
FileBody bin = new FileBody(new File(strXMLFilename));
File file = new File(bin);
reqEntity.addPart("file", bin);
解决方法:
ByteArrayOutputStream bao = new ByteArrayOutputStream();
Constants.getCameraData.compress(Bitmap.CompressFormat.PNG, 100, bao);
byte [] ba = bao.toByteArray();
String photoName = photoNameEdit.getText().toString();
reqEntity.addPart("file", new ByteArrayBody(ba, photoName+".png"));