我正在尝试在Android中使用凌空将PDF文件发布到服务器
选择PDF File Link onClick
Intent intent = new Intent();
intent.setType("application/pdf");
intent.setAction(Intent.ACTION_GET_CONTENT);
startActivityForResult(Intent.createChooser(intent, "Select PDF"), 1);
//使用截击发布数据类型代码
try {
jsonObject10.put("user_id", user_id);
jsonObject10.put("file_path", path);
} catch (JSONException e) {
Log.e("JSONObject Here", e.toString());
}
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, add_url, jsonObject10, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject jsonObject) {
Log.e("Message from server", jsonObject.toString());
progressDialog.dismiss();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError volleyError) {
Log.e("Message from server", volleyError.toString());
progressDialog.dismiss();
}
});
jsonObjectRequest.setRetryPolicy(new DefaultRetryPolicy(5000, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
Volley.newRequestQueue(getActivity()).add(jsonObjectRequest);