I'm not able to upload more 1 mb file in android : Pleae Help me, I have created a program in android for upload file. Everything is working perfectly but when i upload more than 1 mb file i got error from my server "Error while Uploading"
Please Help me.

It's my UploadFile() Method



     private void uploadFile() {
            dialog = ProgressDialog.show(getActivity(), "", "Uploading File...", true);
    
    
            // Map is used to multipart the file using okhttp3.RequestBody
            Map<String, RequestBody> map = new HashMap<>();
            long maxLength = 10000000;
            File file = new File(selectedFilePath);
            if(file.length() > maxLength){
                Toast.makeText(getActivity(), "can't upload file if size more than 10mb", Toast.LENGTH_LONG).show();
                dialog.dismiss();
    
            }else {
                String name = tv_name.getText().toString();
                String email = tv_email.getText().toString();
                // Parsing any Media type file
                RequestBody requestBody = RequestBody.create(MediaType.parse("*/*"), file);
                RequestBody requestBody1 = RequestBody.create(MediaType.parse("text/plain"), name);
                RequestBody requestBody2 = RequestBody.create(MediaType.parse("text/plain"), email);
                map.put("file\"; filename=\"" + selectedFilePath + "\"", requestBody);
                map.put("name\"; username=\"" + name + "\"", requestBody1);
                map.put("email\"; email=\"" + email + "\"", requestBody2);
    
                ApiConfig getResponse = AppConfig.getRetrofit().create(ApiConfig.class);
                Call<ServerResponse> call = getResponse.upload("token", map);
                call.enqueue(new Callback<ServerResponse>() {
                    @Override
                    public void onResponse(Call<ServerResponse> call, Response<ServerResponse> response) {
                        if(dialog.isShowing()){
                            dialog.dismiss();
                        }
                        ServerResponse serverResponse = response.body();
                        if (serverResponse != null) {
                            if (serverResponse.getSuccess()) {
                                Toast.makeText(getActivity(), serverResponse.getMessage(), Toast.LENGTH_SHORT).show();
    
                            } else {
                                Toast.makeText(getActivity(), serverResponse.getMessage(), Toast.LENGTH_SHORT).show();
                            }
                        } else {
    //                    Log.v("Response", serverResponse.toString());
                        }
                       // dialog.dismiss();
                        goToProfile();
    
    
                    }
    
                    @Override
                    public void onFailure(Call<ServerResponse> call, Throwable t) {
                        t.printStackTrace();
                        dialog.dismiss();
                        Toast.makeText(getActivity(), "Failed, Please Try Again", Toast.LENGTH_SHORT).show();
                    }
                });
            }
        }



It's My PHP Code


    $target_dir = "uploads/";
    $target_file_name = $target_dir .basename($_FILES["file"]["name"]);
    $response = array();
     
    // Check if image file is a actual image or fake image
    if (isset($_FILES["file"])) 
    {
     if (move_uploaded_file($_FILES["file"]["tmp_name"], $target_file_name)) 
     {
      $success = true;
      $message = "Successfully Uploaded";
     }
     else 
     {
      $success = false;
      $message = "Error while uploading";
     }
    }
    else 
    {
     $success = false;
     $message = "Required Field Missing";
    }
     
    $response["success"] = $success;
    $response["message"] = $message;
    echo json_encode($response);
     
    ?>

