標籤:
安裝
http://blog.csdn.net/wangwei_cq/article/details/9453345
包內的一些基本的參數
http://www.cnblogs.com/manuosex/p/3583775.html
我的使用方式
13.檔案上傳介面(FORM表單方式提交)功能:上傳檔案到伺服器,之後返回該檔案的URL,最後的jpg表示類型,如果是txt則返回的url類型為txt說明:無需登入地址:http://123.57.54.254:8090/api/Values/PostFileHoleForm/jpg方法:POST請求類型:無傳回型別:{"result":"TRUE","reason":"","url":"http://123.57.54.254/file/7AAD853A05E394EAC8E07654FE62DFD9.jpg"}好糾結啊,方法是POST,而且請求類型為無!RequestParams為無,這麼搞?ios端上傳的是一個body對象,解決辦法是params.put("file", new File(path)),把請求參數“file”當做body client.post(url, params, new AsyncHttpResponseHandler() { @Override public void onSuccess(int statusCode, Header[] headers, byte[] responseBody) { try { if (statusCode == 200) { Toast.makeText(UserInfoHeadActivity.this, "頭像上傳成功!", 0).show(); String response = new String(responseBody); paresJsonWithGSON(response); } else { Toast.makeText(UserInfoHeadActivity.this, "網路訪問異常,錯誤碼:" + statusCode, 0).show(); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } @Override public void onFailure(int statusCode, Header[] headers, byte[] responseBody, Throwable error) { Toast.makeText(UserInfoHeadActivity.this, "網路訪問異常,錯誤碼 > " + statusCode, 0).show(); } });
android-async-http