Upload not rendering on my form

Hi all,

I’m having issues using the Vaadin Upload component.
Whatever I try, it’s not rendering on the page.
I first tried it on a Dialog, and now directly on a form, but it doesn’t work.

I just create MemoryBuffer, then a Upload component, add a SucceededListener and add it to the form.

Any idea’s what might be going wrong?

I’ve been fighting this for over 2 hours :-/

Thanks!

18452535.png

Could you please share the Java code that you’re using to add the Upload component?

Sure,

MemoryBuffer buffer = new MemoryBuffer();
Upload upload = new Upload(buffer);
upload.setAcceptedFileTypes("image/png");
upload.addSucceededListener(event -> {
	String base64 = processUpload(
		event.getMIMEType(),
		buffer.getInputStream()
	);
	logo = base64;
});

upload.setId("test-upload");


FormLayout formLayout = new FormLayout(name, description, addressLine1, addressLine2, postalCode, city, country, upload);

That looks fine (the same code works like a charm for me in a FormLayout and in a Dialog). Not sure what might be the issue here. You might want to try with a fresh starter project to check whether the problem is somehow specific to this project’s setup.

It’s strange.
When I add this:
upload.setUploadButton(new Button(“Upload”));
then I do see that button, so something is rendering of that component.

I just also tried upgrading to 14.4.0, but that didn’t change it either.

I think the classpath also looks OK.
.m2/repository/com/vaadin/vaadin-upload-flow/2.3.0/vaadin-upload-flow-2.3.0.jar
.m2/repository/org/webjars/bowergithub/vaadin/vaadin-upload/4.4.0/vaadin-upload-4.4.0.jar

It’s just strange that there is nothing in the tag when I inspect it.

<vaadin-upload target="VAADIN/dynamic/resource/1/7f898dc7-9382-42b8-af06-7cbf2ea631dc/upload" style="width: 250px;height: 100px;"></vaadin-upload>

Ah man …

mvn clean fixed it!!!
18452620.png