{"action":"opened","issue":{"url":"https://api.github.com/repos/loopj/android-async-http/issues/1168","repository_url":"https://api.github.com/repos/loopj/android-async-http","labels_url":"https://api.github.com/repos/loopj/android-async-http/issues/1168/labels{/name}","comments_url":"https://api.github.com/repos/loopj/android-async-http/issues/1168/comments","events_url":"https://api.github.com/repos/loopj/android-async-http/issues/1168/events","html_url":"https://github.com/loopj/android-async-http/issues/1168","id":158553033,"number":1168,"title":"Save me ! Please help me . I am crashed.","user":{"login":"Oterman1314","id":11433660,"avatar_url":"https://avatars.githubusercontent.com/u/11433660?v=3","gravatar_id":"","url":"https://api.github.com/users/Oterman1314","html_url":"https://github.com/Oterman1314","followers_url":"https://api.github.com/users/Oterman1314/followers","following_url":"https://api.github.com/users/Oterman1314/following{/other_user}","gists_url":"https://api.github.com/users/Oterman1314/gists{/gist_id}","starred_url":"https://api.github.com/users/Oterman1314/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Oterman1314/subscriptions","organizations_url":"https://api.github.com/users/Oterman1314/orgs","repos_url":"https://api.github.com/users/Oterman1314/repos","events_url":"https://api.github.com/users/Oterman1314/events{/privacy}","received_events_url":"https://api.github.com/users/Oterman1314/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2016-06-05T12:53:14Z","updated_at":"2016-06-05T12:53:14Z","closed_at":null,"body":"i was trying to upload a pic to the server. I use AsyncHttpClient to send a post request.\r\ni should get the response like  this\r\n\r\n```\r\n<meta http-equiv='Refresh' content='0; url=bbsupload2?board=Pictures\r\n&file=10104&name=LilyDroid0605184406.jpg&exp=UploadByLilyDroid\r\n&ptext=\r\n'>\r\n```\r\n# but i got nothing!   nothing!\r\n## i dont know what was wrong. when i debug, i can step into the onSuccess method.  the headers is ok! but the responseBody is empty. why! I am crashed.  \r\n\r\n\r\n\r\n\r\n\r\nthis is the code:\r\n```\r\npublic static void uploadFile(Context context,final WaitDialog waitDialog,File file){\r\n\t\t  \r\n\t\tAsyncHttpClient ahc=new AsyncHttpClient();\r\n\t\t\r\n\t\tString url=Constants.getUploadUrl();\r\n\t\t\r\n\t\tahc.addHeader(\"Content-Type\", \"multipart/form-data\");\r\n\t\t\r\n\t\tString cookie=BaseApplication.getCookie();\r\n\t\tif(cookie==null){\r\n\t\t\tcookie=BaseApplication.autoLogin(context, true);\r\n\t\t}\r\n\t\t\r\n\t\t//njubbs_upload36649831.jpg\r\n\t\tahc.addHeader(\"Cookie\", cookie);\r\n\t\tRequestParams rp=new RequestParams();\r\n\t\t\r\n\t\ttry {\r\n\t\t\trp.put(\"up\", file);\r\n\t\t} catch (Exception e1) {\r\n\t\t\te1.printStackTrace();\r\n\t\t}\r\n\t\t\r\n\t\trp.put(\"exp\", \"\");\r\n\t\trp.put(\"ptext\", \"text\");\r\n\t\trp.put(\"board\", \"Pictures\");\r\n\t\t\r\n\t\tahc.post(url, rp,new AsyncHttpResponseHandler() {\r\n\t\t\tpublic void onSuccess(int statusCode, Header[] headers, byte[] responseBody) {\r\n\t\t\t\tLogUtil.d(\"结果：\"+statusCode);//Content-Encoding: gzip\r\n\t\t\t\twaitDialog.dismiss();\r\n\t\t\t\tif(statusCode==200){\r\n\t\t\t\t\ttry {\r\n\t\t\t\t\t\tString result=new String(responseBody,\"gb2312\");\r\n\t\t\t\t\t\tLogUtil.d(\"result:\"+result);\r\n\t\t\t\t\t} catch (Exception e) {\r\n\t\t\t\t\t\te.printStackTrace();\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tpublic void onFailure(int statusCode,\r\n\t\t\t\t\tHeader[] headers,\r\n\t\t\t\t\tbyte[] responseBody, Throwable error) {\r\n\t\t\t\twaitDialog.dismiss();\r\n\t\t\t\tLogUtil.d(\"结果：\"+statusCode+ new String(responseBody).toString());\r\n\t\t\t\terror.printStackTrace();\r\n\t\t\t}\r\n\r\n\t\t});\r\n\t}\r\n```\r\n"}}
{"actor":{"display_login":"Oterman1314"}}