vaadin / vaadin-upload

The Web Component for uploading multiple files with progress indication. Part of the Vaadin components.
https://vaadin.com/components
Apache License 2.0
90 stars 63 forks source link

the upload component can't work in latest vaddin 12.0.0 #294

Closed LaiZhou closed 5 years ago

LaiZhou commented 5 years ago

when upgrade to 12.0.0,the upload component can't listen the event. code:

 MultiFileMemoryBuffer buffer = new MultiFileMemoryBuffer();
        upload.setReceiver(buffer);
        upload.setAcceptedFileTypes("image/jpeg", "image/png", "image/gif", "image/jpg");
        upload.addSucceededListener(event -> {
            try {
                String imgName = MD5Util.md5(UUID.randomUUID().toString()) + "." + event.getFileName().split("\\.")[1];
                FileUtils.writeByteArrayToFile(new File("/statics/imgs/" + imgName),
                        IOUtils.toByteArray(buffer.getInputStream(event.getFileName())));
                getModel().getImgs().add(imgName);

            } catch (Exception e) {
                getLogger().error("upload error", e);
                showNotification("图片保存失败:"+e.getMessage(),true);

            }
        });
limonte commented 5 years ago

This issue was moved to vaadin/vaadin-upload-flow#104