Home > Mobile >  Big guy to help novice okhttp upload pictures
Big guy to help novice okhttp upload pictures

Time:10-13

I want to use okhttp on Android to the server-side upload picture: QQQ. The PNG what should I in the back end use servlet receives the image and save it?

MultipartBody. Builder multipartBuilder=new MultipartBody. Builder ();
RequestBody RequestBody=multipartBuilder. SetType (MultipartBody. FORM)
AddFormDataPart (" username ", ": QQQ")
AddFormDataPart (" password ", "123")
AddFormDataPart (" mPhoto ", ": QQQ. PNG", RequestBody. Create (MediaType. Parse (" application/octet - stream "), the file))
.build();
  • Related