I am using the code in this tutorial Upload an Image or File to Your Server Using Volley in Kotlin
The code works I can upload an image but I also need to post other values together with the image in the same request. Following is the code which perform the upload. How do I add the other post values to the request?
private fun uploadImage() {
imageData?: return
val request = object : VolleyFileUploadRequest(
Method.POST,
postURL,
Response.Listener {
println("response is: $it")
},
Response.ErrorListener {
println("error is: $it")
}
) {
override fun getByteData(): MutableMap<String, FileDataPart> {
var params = HashMap<String, FileDataPart>()
params["imageFile"] = FileDataPart("image", imageData!!, "jpeg")
return params
}
}
Volley.newRequestQueue(this).add(request)
}