koush / ion

Android Asynchronous Networking and Image Loading
Other
6.29k stars 1.03k forks source link

Server receive empty while using "setMultipartParameter" #789

Open AviadKlein10 opened 7 years ago

AviadKlein10 commented 7 years ago

Hey. I searched for hours and found nothing. I'm trying to send an image to my server using Node.js. But when trying to send using setMultipartParameter the server receive an empty request. This is the request:

public void sendImageByteArrayToServer(String userId, String imageIndexInArray, File imageFile) { Ion.with(context) .load("POST",serverIp + "/api/user/uploadImage") .uploadProgressBar(new ProgressBar(context)) .setMultipartParameter("userId",userId) .setMultipartParameter("imgOrder",imageIndexInArray) .setMultipartFile("imgFile", imageFile) .asJsonObject() .setCallback(new FutureCallback() { @Override public void onCompleted(Exception e, JsonObject result) { Log.d("ImageResult", result +""); Log.d("ImageException", e+""); } });

What am I doing wrong?

Thank you

AviadKlein10 commented 7 years ago

My server side handle this. Thank you anyway And thank you for the great library!

ani27 commented 7 years ago

@AviadKlein10 I am facing the same issue can you please tell me how did you resolved the issue?

AviadKlein10 commented 7 years ago

If I remember the problem was that the server side and client side had different key for the parameters. Its importent to check this