【发布时间】:2018-04-01 16:23:41
【问题描述】:
嗯,这可能是一个简单的问题,但是在我的应用程序中,我必须将一些数据上传到服务器,这将是一些用户图像(3 或 4)以及一些其他用户数据(姓名、通行证、年龄、等等..)。
为此,我将使用 Volley,并且从答案 HERE 我一直在阅读有关使用 MultipartRequest 的信息。
但是,我不确定区别或使用 MultipartRequest 的好处,如果在通常的 StringRequest 我有方法 getParams 我可以这样做:
override fun getParams(): Map<String, String> {
val params = HashMap<String, String>()
params.put("image1", encodedImage1Base64)
params.put("image2", encodedImage2Base64)
params.put("image3", encodedImage3Base64)
params.put("image4", encodedImage4Base64)
params.put("user_name", userName)
params.put("user_pass", userPass)
params.put("user_age", userAge)
params.put("user_email", userEmail)
// and any other user data needed
return params
【问题讨论】:
标签: android request android-volley multipartform-data