0

i want upload to Spring server @RequestBody

json and multipart-file(imgaefile) at ones.

how do i do?

Thanks for help.

4
  • I tried follow homepage guide. but RequestParam is not Resposebody Commented Jun 22, 2016 at 5:49
  • Finally i am success upload. image -> BASE64 text.... but i think this way is NOT Right way. Commented Jun 22, 2016 at 5:56
  • 1
    The ultimate goal of the question is find the better way upload to server. Commented Jun 22, 2016 at 5:57
  • Does not matter Library. if you know better than AsyncHttpClient Library, please share your's knowhow. Commented Jun 23, 2016 at 2:28

1 Answer 1

1

I also had the same requirement I have used this code to Put the the image into server

    RequestParams params = new RequestParams();
    try {
        params.put("photo", FragmentPhotoCrop.croppedFile, "image/jpeg");  // croppedFile is a FIle 
        params.setUseJsonStreamer(false);
    } catch (FileNotFoundException e) {
    }

    asyncHttpClient.put(getActivity(), url, params, new AsyncHttpResponseHandler() { ..

       //enter code here

    }

Hope it may help :)

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.