【发布时间】:2017-06-27 07:22:35
【问题描述】:
我想从图库上传照片。当我从图库上传从相机捕获的图像时,会发生此错误。
截击代码如下:
StringRequest stringRequest = new StringRequest(Request.Method.POST, url, new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Toast.makeText(upload.this,response, Toast.LENGTH_SHORT).show();
}
},
new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) { error.printStackTrace();
}
}){
protected Map<String,String> getParams()
{
Map<String,String> params = new HashMap<String, String>();
params.put("photo",str_photo);
params.put("title",str_caption);
params.put("name",str_caption);
params.put("admin_id",admin_id);
return params;
}
};
RequestQueue requestQueue = Volley.newRequestQueue(upload.this);
requestQueue.add(stringRequest);
logcat如下
06-28 10:24:43.442 8774-10428/laurel.wedding E/Volley: [1802] BasicNetwork.performRequest: Unexpected response code 413 for http://teachieparentine.com/Wedding_App/photo_upload.php
【问题讨论】:
-
你用 Postman 试过同样的 api 吗?