How to upload multipart form data and image to server in android?

后端 未结 6 546
醉梦人生
醉梦人生 2020-11-29 04:39

Status code 500 during upload multipart entity image to server in android code

Html form: (can add successfully image to server)

          


        
6条回答
  •  心在旅途
    2020-11-29 05:15

    hi after having lots of search trial and error finally got this friends

    //on how to upload image to facebook using graph apis

                    Bundle params = new Bundle();
    
                        params.putByteArray("multipart/form-data",byteArray);
    
                        params.putString("caption",txtcaption.getText().toString());
                        /* make the API call */
                        new GraphRequest(
                                AccessToken.getCurrentAccessToken(),
                                "/me/photos",
                                params,
                                HttpMethod.POST,
                                new GraphRequest.Callback() {
                                    public void onCompleted(GraphResponse response) {
                                        /* handle the result */
                                        Log.e("responseImagedata---", response.toString());
    
                                    }
                                }
                        ).executeAsync();
    

提交回复
热议问题