privatevoid uploadved(final String pdfname,Uri pdffile){ProgressDialog progressDialog =ProgressDialog.show(uploadved.this,"جارى ارسال الفيديو","برجاء الانتظار",false,false);InputStream iStream = null;try{
iStream = getContentResolver().openInputStream(pdffile);
final byte[] inputData = getBytes(iStream);VolleyMultipartRequest volleyMultipartRequest =newVolleyMultipartRequest(Request.Method.POST,URLphp,newResponse.Listener<NetworkResponse>(){@Overridepublicvoid onResponse(NetworkResponse response){Log.d("ressssssoo",newString(response.data));Toast.makeText(uploadved.this, response.toString(),Toast.LENGTH_SHORT).show();
progressDialog.dismiss();
rQueue.getCache().clear();try{JSONObject jsonObject =newJSONObject(newString(response.data));Toast.makeText(getApplicationContext(), response.toString(),Toast.LENGTH_SHORT).show();}catch(JSONException e){
e.printStackTrace();}}},newResponse.ErrorListener(){@Overridepublicvoid onErrorResponse(VolleyError error){Toast.makeText(getApplicationContext(), error.getMessage(),Toast.LENGTH_SHORT).show();}}){/*
* If you want to add more parameters with the image
* you can do it here
* here we have only one parameter with the image
* which is tags
* */@OverrideprotectedMap<String,String> getParams() throws AuthFailureError{Map<String,String> params =newHashMap<>();
params.put("gsdfg", shall.getInstance(uploadved.this).getuserShow());
params.put("fsdf", shall.getInstance(uploadved.this).getimage());
params.put("idgdfgus", shall.getInstance(uploadved.this).getid());
params.put("fasd",enwanvido);return params;}/*
*pass files using below method
* */@OverrideprotectedMap<String,DataPart> getByteData(){Map<String,DataPart> params =newHashMap<>();
params.put("imgshare",newDataPart(pdfname ,inputData));Log.d("testerget work","workingpartdata");return params;}};
volleyMultipartRequest.setRetryPolicy(newDefaultRetryPolicy(0,DefaultRetryPolicy.DEFAULT_MAX_RETRIES,DefaultRetryPolicy.DEFAULT_BACKOFF_MULT));
rQueue =Volley.newRequestQueue(uploadved.this);
rQueue.add(volleyMultipartRequest);}catch(FileNotFoundException e){
e.printStackTrace();}catch(IOException e){
e.printStackTrace();}}
السؤال
Drive Man
4 أجوبة على هذا السؤال
Recommended Posts
انضم إلى النقاش
يمكنك أن تنشر الآن وتسجل لاحقًا. إذا كان لديك حساب، فسجل الدخول الآن لتنشر باسم حسابك.