how to file upload browser window in only show .pdf file?

upload componets in browse file click and open browser window in only show .pdf file?


I’m afraid that question is pretty much impossible to understand; are you asking “How to I limit the files presented by the Upload component to just be *.pdf?”

I’m afraid the simple answer is “you can’t” - the vaadin Upload component is a wrapper around GWT File Upload, which in turn is really “just” an element- and that, in turn, does not allow you to limit the files presented. See
this stackoverflow question
for a little more detail.



Well it is of course possible to check the file-extension in a StartedListener:

public void uploadStarted(StartedEvent event) {
		int dotIndex = event.getFilename().lastIndexOf('.');
		String fileExt = event.getFilename().substring(dotIndex + 1);
		String[] allowedFileTypes = configProvider.getAllowedFileTypes();
		for(String allowedFileType : allowedFileTypes) {
			if(StringUtils.equalsIgnoreCase(fileExt, allowedFileType)) {
				validFiletype = true;
		if(!validFiletype) {

Oh, absolutely, but you can’t stop a user trying to pick the wrong type of tile in the first place…

Good shout though.