docs: public static void checkCreateUpload(CmsObject cms, CmsUgcConfiguration config, String name, long size)
      throws CmsUgcException {
  
          if (!config.getUploadParentFolder().isPresent()) {
              String message = Messages.get().container(Messages.ERR_NO_UPLOADS_ALLOWED_0).key(
                  cms.getRequestContext().getLocale());
              throw new CmsUgcException(CmsUgcConstants.ErrorCode.errNoUploadAllowed, message);
          }
  
          if (config.getMaxUploadSize().isPresent()) {
              if (config.getMaxUploadSize().get().longValue() < size) {
                  String message = Messages.get().container(Messages.ERR_UPLOAD_TOO_BIG_1, name).key(
                      cms.getRequestContext().getLocale());
                  throw new CmsUgcException(CmsUgcConstants.ErrorCode.errMaxUploadSizeExceeded, message);
              }
          }
  
          if (config.getValidExtensions().isPresent()) {
              List<String> validExtensions = config.getValidExtensions().get();
              boolean foundExtension = false;
              for (String extension : validExtensions) {
                  if (name.toLowerCase().endsWith(extension.toLowerCase())) {
                      foundExtension = true;
                      break;
                  }
              }
              if (!foundExtension) {
                  String message = Messages.get().container(Messages.ERR_UPLOAD_FILE_EXTENSION_NOT_ALLOWED_1, name).key(
                      cms.getRequestContext().getLocale());
                  throw new CmsUgcException(CmsUgcConstants.ErrorCode.errInvalidExtension, message);
              }
          }
      }