Dio: multipart 数据上传失败

Created on 5 Nov 2019  ·  2Comments  ·  Source: flutterchina/dio

| Platform Name : android
| Dio Version : 3.0.4

FormData data = FormData.fromMap({
"imageBest":MultipartFile.fromBytes(imageBest,filename:"best.jpg"),
"envImage":MultipartFile.fromBytes(envImage,filename:"env.jpg"),
"delta":MultipartFile.fromString(delta)
}
Dio.post("url",data:data);
Charles抓包如下:
mutilPart1

发起的请求,无法生成下图multipart文件:
mutilpart2
上图用okHttp+Retrofit 发起的请求生成的multipart文件
方式: Observable putXXX(@Part MultipartBody.Part imageBest,
@Part MultipartBody.Part imageEnv,
@Part MultipartBody.Part delta,}
导致后台无法拿到对应的multipart参数?

Dio如何处理才能实现这个?

stale

Most helpful comment

我也遇到multipart 上传失败的问题了,3.0.3可以正常上传,3.0.5上传失败

All 2 comments

我也遇到multipart 上传失败的问题了,3.0.3可以正常上传,3.0.5上传失败

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. If this is still an issue, please make sure it is up to date and if so, add a comment that this is still an issue to keep it open. Thank you for your contributions.

Was this page helpful?
0 / 5 - 0 ratings