以下是图片上传方式:
接口写法:
@Multipart实现写法:
@POST("/user/addLicenseInfo")
void addLicenseInfo(@QueryMap Map<String, Object> options, @Part("file") TypedFile file, Callback<JsonElement> response);
API api = mRegisterActivity.createAPI();
Map<String, Object> options = new HashMap<String, Object>();
options.put("mobile",photoNumber);
TypedFile typedImage = new TypedFile(getMIMEType(pictureFile), pictureFile);
api.addLicenseInfo(options,typedImage,new Callback<JsonElement>(){};
请问大神 以二进制流上传 上传参数应该怎么写?
------解决思路----------------------
上传图片:把Bitmap转换为二进制流 用 ByteArrayOutputStream 捕获内存缓冲区的数据,转换成字节数组!!!
------解决思路----------------------
那不有好多参数类型吗,其中就有个TypedByteArray 感觉这个应该就是二进制的了吧,没用过,都是直接传个文件,就和你代码里一样