Does anyone know why mu upload SucceededListener is sometimes called and sometimes is not?
I make Vaadin Upload component and add a listener to it, and in listener I put System.out.println(“SUCCEEDED”).
Sometimes is printed when file is uploaded, and sometimes doesn’t upload file at all.
I am using Vaadin 10 with Spring boot starter pack.
i have the same problem. I’m trying out vaadin and wanted to use upload. I only use java not direct html. My files never get uploaded. I also have an UploadReceiver attached with some println or logs… something that just gets called.
So i cannot help you. But perhaps we could investigate this together.
I solved this problem. I had a problem with Vaadin 10 version and it didn’t work on 10.7. I have changed Vaadin version in my pom.xml file to 10.6 and now it is working. I hope that this will help you
that solved it. I changed to Version 10.0.6 and Spring Boot 2.0.3.RELEASE (10.0.6 did not start with Spring Boot 2.0.10.RELEASE).
I would file a bug report if i knew what to write, but i don’t have any information but that it does not work.
Thank you again!
import javax.annotation.PostConstruct;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.vaadin.flow.component.Text;
import com.vaadin.flow.component.button.Button;
import com.vaadin.flow.component.html.Div;
import com.vaadin.flow.component.notification.Notification;
import com.vaadin.flow.component.upload.Upload;
import com.vaadin.flow.component.upload.receivers.MemoryBuffer;
import com.vaadin.flow.router.Route;
@Route("")
public class MainUI extends Div {
private Upload upload;
MemoryBuffer buffer = new MemoryBuffer();
private static final Logger LOG = LoggerFactory.getLogger(MainUI.class);
@PostConstruct
public void init() {
upload = new Upload(buffer);
upload.onEnabledStateChanged(true);
upload.addSucceededListener(event -> {
Text text = new Text(event.getFileName());
add(text);
});
add(upload);
}
}