UploadFile Error 不够明细
風一樣的男子
2012-09-22
DefaultSecurityManager#checkUploadFile
private MainError checkUploadFile(RopRequestContext rrctx) { ServiceMethodHandler serviceMethodHandler = rrctx.getServiceMethodHandler(); if (serviceMethodHandler != null && serviceMethodHandler.hasUploadFiles()) { List<String> fileFieldNames = serviceMethodHandler.getUploadFileFieldNames(); for (String fileFieldName : fileFieldNames) { String paramValue = rrctx.getParamValue(fileFieldName); if (paramValue != null) { if (paramValue.indexOf("@") < 0) { return MainErrors.getError(MainErrorType.UPLOAD_FAIL, rrctx.getLocale()); } else { String fileType = UploadFileUtils.getFileType(paramValue); if (!fileUploadController.isAllowFileType(fileType)) {//不支持的文件类型 return MainErrors.getError(MainErrorType.UPLOAD_FAIL, rrctx.getLocale()); } byte[] fileContent = UploadFileUtils.decode(paramValue); if (fileUploadController.isExceedMaxSize(fileContent.length)) {//大小超出限制 return MainErrors.getError(MainErrorType.UPLOAD_FAIL, rrctx.getLocale()); } } } } } return null; } |