code: public void uploadFields(
          final Set<String> fields,
          final Function<Map<String, String>, Void> filenameCallback,
          final I_CmsErrorCallback errorCallback) {
  
          disableAllFileFieldsExcept(fields);
          final String id = CmsJsUtils.generateRandomId();
          updateFormAction(id);
          // Using an array here because we can only store the handler registration after it has been created , but
          final HandlerRegistration[] registration = {null};
          registration[0] = addSubmitCompleteHandler(new SubmitCompleteHandler() {
  
              @SuppressWarnings("synthetic-access")
              public void onSubmitComplete(SubmitCompleteEvent event) {
  
                  enableAllFileFields();
                  registration[0].removeHandler();
                  CmsUUID sessionId = m_formSession.internalGetSessionId();
                  RequestBuilder requestBuilder = CmsXmlContentUgcApi.SERVICE.uploadFiles(
                      sessionId,
                      fields,
                      id,
                      new AsyncCallback<Map<String, String>>() {
  
                      public void onFailure(Throwable caught) {
  
                          m_formSession.getContentFormApi().handleError(caught, errorCallback);
  
                      }
  
                      public void onSuccess(Map<String, String> fileNames) {
  
                          filenameCallback.apply(fileNames);
  
                      }
                  });
                  m_formSession.getContentFormApi().getRpcHelper().executeRpc(requestBuilder);
                  m_formSession.getContentFormApi().getRequestCounter().decrement();
              }
          });
          m_formSession.getContentFormApi().getRequestCounter().increment();
          submit();
      }
docs: Uploads files from the given file input fields.<p<
  
  @param fields the set of names of fields containing the files to upload
  @param filenameCallback the callback to call with the resulting map from field names to file paths
  @param errorCallback the callback to call with an error message