如何发送base64图像作为凌空的atachment?

时间:2015-06-07 07:11:36

标签: android base64 android-volley

我应该在请求体中发送图像,我该如何制作?

RequestQueue requestQueue = Volley.newRequestQueue(getActivity());
String url = getString(R.string.url) + "auth/avatar?token="+ Utils.getToken(getActivity());
JsonObjectRequest request = new JsonObjectRequest(Request.Method.POST, url, null, new Response.Listener<JSONObject>() {
    @Override
    public void onResponse(JSONObject jsonObject) {
        Log.d("myLogs", jsonObject.toString());
    }
}, new Response.ErrorListener() {
    @Override
    public void onErrorResponse(VolleyError volleyError) {

    }
}) {
    @Override
    protected Map<String, String> getParams() {
        Map<String, String> params = new HashMap<String, String>();
        params.put("avatar", encodedImage);
        return params;
    }       
};

requestQueue.add(request);

我已阅读this article,但它对我没有帮助。

0 个答案:

没有答案