Examples of WebErrors


Examples of com.jeecms.core.web.WebErrors

        TPLDIR_MEMBER, RESULT_PAGE);
  }

  private WebErrors validate(String filename, MultipartFile file,
      HttpServletRequest request) {
    WebErrors errors = WebErrors.create(request);
    if (file == null) {
      errors.addErrorCode("imageupload.error.noFileToUpload");
      return errors;
    }
    if (StringUtils.isBlank(filename)) {
      filename = file.getOriginalFilename();
    }
    String ext = FilenameUtils.getExtension(filename);
    if (!ImageUtils.isValidImageExt(ext)) {
      errors.addErrorCode("imageupload.error.notSupportExt", ext);
      return errors;
    }
    try {
      if (!ImageUtils.isImage(file.getInputStream())) {
        errors.addErrorCode("imageupload.error.notImage", ext);
        return errors;
      }
    } catch (IOException e) {
      log.error("image upload error", e);
      errors.addErrorCode("imageupload.error.ioError", ext);
      return errors;
    }
    return errors;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.