2

I am working on an application in which I need to upload image on server with several parameters. I am using multipart functionality to upload image on server. I am using 'net.gotev:uploadservice:2.1' library to upload image on server. I am able to upload image with several parameters on server but not able to fetch response.

Code :

     try {
            String uploadId = UUID.randomUUID().toString();

            //Creating a multi part request
            new MultipartUploadRequest(getActivity(), uploadId, "http://url")
                    .addFileToUpload(path, "image") //Adding file
                    .addParameter("api_token", api_token)
                    //Adding text parameter to the request
                    .addParameter("name", "etName.getText().toString()")
                    .addParameter("introduction", "intro")
                    .addParameter("advisor_id", user.get("id"))
                    .addParameter("category", "etCompany_name.getText().toString()")
                    .addParameter("expertise", user.get("specialist"))
                    .addParameter("expertise", user.get("specialist"))
                    .addParameter("experience", user.get("specialist"))
                    .addParameter("email", user.get("specialist"))

                    .setNotificationConfig(new UploadNotificationConfig())
                    .setMaxRetries(2)
                    .startUpload(); //Starting the upload




        } catch (Exception exc) {
            Toast.makeText(getActivity(), exc.getMessage(), Toast.LENGTH_SHORT).show();
        }

Using this code I am able to uplaod image and parameters on server but not able to fetch response. Please help.

D Developer
  • 73
  • 1
  • 9

0 Answers0