显示多部分文件上载的原始文件名

时间:2015-01-26 07:29:45

标签: java spring pdf file-upload filenames

在Spring Java中将pdf文件作为多部分文件上传后,如何获取原始文件名?

我上传了pdf文件,它会显示在表格行中,但它只显示如下, 的 org.springframework.web.multipart.commons.CommonsMultipartFile@17dbc7f5

public List<UIPrmClaimTransportationRecord> addTransportClaimToList(UIPrmClaimTransportationRecord toAdd, List<UIPrmClaimTransportationRecord> toReturn) throws ParseException, CoreException, CoreKnownException, NumberFormatException {
        if (toAdd == null)
            throw new CoreException("toAdd object is null", Constants.ERROR_CODE_ER0999);
        if (toAdd.getTranscationDateInString() == null || toAdd.getTranscationDateInString().equals(Constants.EMPTY_STRING))
            throw new CoreKnownException(Constants.ERROR_CODE_ER0059, Constants.ERROR_CODE_ER0059);
        if (toAdd.getType() == null || toAdd.getType().equals(Constants.EMPTY_STRING))
            throw new CoreKnownException(Constants.ERROR_CODE_ER0031, Constants.ERROR_CODE_ER0031);
        if (toAdd.getAmountInString() == null || toAdd.getAmountInString().equals(Constants.EMPTY_STRING))
            throw new CoreKnownException(Constants.ERROR_CODE_ER0097, Constants.ERROR_CODE_ER0097);

        SimpleDateFormat sdf = new SimpleDateFormat(propertiesConstants.getSimpleDateFormat());
        sdf.parse(toAdd.getTranscationDateInString());

        Double toTest = Double.parseDouble(toAdd.getAmountInString());
        if (toTest < 1)
            throw new CoreKnownException(Constants.ERROR_CODE_ER0033, Constants.ERROR_CODE_ER0033);

        if (toReturn == null)
            toReturn = new ArrayList<UIPrmClaimTransportationRecord>();

        toAdd.getEndLocation().toUpperCase().toString();
        toAdd.getStartLocation().toUpperCase().toString();
        toAdd.getReason().toUpperCase().toString();
        toAdd.getUploadFile();

        toReturn.add(toAdd);

        return toReturn;
    } 

0 个答案:

没有答案