You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a custom file extension, let's call it .hello.world.
When I set it as an accepted file type of the Upload with Upload#setAcceptedFileTypes, corresponding files can be selected with the file chooser as expected.
However, when choosing the file, the file is not added to the Upload and a FileRejectedEvent is thrown with the message Incorrect File Type..
I created a html test file to see if this is generally unsupported but doing it in plain HTML, it was possible. See the attached HTML file. input-file-text.html.txt
Expected outcome
I am able to successfully add a file with multiple dots in the file extension if it's set as an accepted file type.
Minimal reproducible example
importcom.vaadin.flow.component.button.Button;
importcom.vaadin.flow.component.dialog.Dialog;
importcom.vaadin.flow.component.html.NativeButton;
importcom.vaadin.flow.component.orderedlayout.VerticalLayout;
importcom.vaadin.flow.component.upload.Upload;
importjava.io.Serial;
publicfinalclassUploadDialogextendsDialog {
@SerialprivatestaticfinallongserialVersionUID = 7866430661088575019L;
privatefinalButtonupdateButton = newButton("Upload");
publicUploadDialog() {
updateButton.setEnabled(false);
finalUploadupload = getUpload();
add(newVerticalLayout(upload, updateButton));
updateButton.addClickListener(evt -> {
System.out.println("Start uploading.");
close();
});
}
privateUploadgetUpload() {
finalUploadupload = newUpload();
finalNativeButtonuploadButton = newNativeButton("Upload");
upload.setUploadButton(uploadButton);
upload.setAcceptedFileTypes(".hello.world"); // Only works in some browsers according to the docs.upload.addFileRejectedListener(evt -> System.out.println("Failed to add a file: " + evt.getErrorMessage()));
upload.addSucceededListener(evt -> {
System.out.println("Successfully added " + evt.getFileName());
updateButton.setEnabled(true);
});
returnupload;
}
}
Steps to reproduce
Create a new instance of UploadDialog and open it.
Download the following file and remove the .txt suffix (needed for GitHub): test-file.hello.world.txt
Try to add that file.
Environment
Vaadin version(s): 23.2.16 (Currently not able to use VAADIN 23.3.X so a backport for 23.2.X would be nice.)
OS: Windows 10
Browsers
Issue is not browser related
The text was updated successfully, but these errors were encountered:
Description
I have a custom file extension, let's call it
.hello.world
.When I set it as an accepted file type of the Upload with
![image](https://user-images.githubusercontent.com/7572614/223461822-7fd94756-fccb-4d05-b3b0-dffe60788fec.png)
Upload#setAcceptedFileTypes
, corresponding files can be selected with the file chooser as expected.However, when choosing the file, the file is not added to the Upload and a
FileRejectedEvent
is thrown with the messageIncorrect File Type.
.I created a html test file to see if this is generally unsupported but doing it in plain HTML, it was possible. See the attached HTML file.
input-file-text.html.txt
Expected outcome
I am able to successfully add a file with multiple dots in the file extension if it's set as an accepted file type.
Minimal reproducible example
Steps to reproduce
UploadDialog
and open it..txt
suffix (needed for GitHub): test-file.hello.world.txtEnvironment
Vaadin version(s): 23.2.16 (Currently not able to use VAADIN 23.3.X so a backport for 23.2.X would be nice.)
OS: Windows 10
Browsers
Issue is not browser related
The text was updated successfully, but these errors were encountered: