code: public MultipartUploadRequest addFileToUpload(String filePath,
                                                    String parameterName,
                                                    String fileName, String contentType)
              throws FileNotFoundException, IllegalArgumentException {
  
          UploadFile file = new UploadFile(filePath);
          filePath = file.getPath();
  
          if (parameterName == null || "".equals(parameterName)) {
              throw new IllegalArgumentException("Please specify parameterName value for file: "
                                                 + filePath);
          }
  
          file.setProperty(MultipartUploadTask.PROPERTY_PARAM_NAME, parameterName);
  
          if (contentType == null || contentType.isEmpty()) {
              contentType = file.getContentType(context);
              Logger.debug(LOG_TAG, "Auto-detected MIME type for " + filePath
                      + " is: " + contentType);
          } else {
              Logger.debug(LOG_TAG, "Content Type set for " + filePath
                      + " is: " + contentType);
          }
  
          file.setProperty(MultipartUploadTask.PROPERTY_CONTENT_TYPE, contentType);
  
          if (fileName == null || "".equals(fileName)) {
              fileName = file.getName(context);
              Logger.debug(LOG_TAG, "Using original file name: " + fileName);
          } else {
              Logger.debug(LOG_TAG, "Using custom file name: " + fileName);
          }
  
          file.setProperty(MultipartUploadTask.PROPERTY_REMOTE_FILE_NAME, fileName);
  
          params.files.add(file);
          return this;
      }
docs: Adds a file to this upload request.
  
  @param filePath path to the file that you want to upload
  @param parameterName Name of the form parameter that will contain file's data
  @param fileName File name seen by the server side script. If null, the original file name
  will be used
  @param contentType Content type of the file. You can use constants defined in
  {@link ContentType} class. Set this to null or empty string to try to
  automatically detect the mime type from the file. If the mime type can't
  be detected, {@code application/octet-stream} will be used by default
  @throws FileNotFoundException if the file does not exist at the specified path
  @throws IllegalArgumentException if one or more parameters are not valid
  @return {@link MultipartUploadRequest}