diff options
author | Anastasia Smirnova <anasmi@utu.fi> | 2019-10-16 12:34:06 +0300 |
---|---|---|
committer | Olli Tietäväinen <ollit@vaadin.com> | 2019-10-16 12:34:06 +0300 |
commit | 94fb3c2c08a3545705835194266cebbcb953c04a (patch) | |
tree | e16ba6e79272e2a1e20925914d3ab424c728c507 /client/src | |
parent | 58a9520398348393378a0b98ae12a2c74c3463bb (diff) | |
download | vaadin-framework-94fb3c2c08a3545705835194266cebbcb953c04a.tar.gz vaadin-framework-94fb3c2c08a3545705835194266cebbcb953c04a.zip |
Upload should preserve MIMEType after first selection (#11745)
* Upload should preserve MIMEType after first selection
Fix #11698
Automated test is not run locally, need to continue with it
* Remove unused imports
* Add sleep time in testing purposes
* Getting a new instance of an input, after file is downloaded
Exclude IE from tests. Throws https://stackoverflow.com/questions/23883071/unhandled-alert-exception-modal-dialog-present-selenium , but checked manually and it works
Diffstat (limited to 'client/src')
-rw-r--r-- | client/src/main/java/com/vaadin/client/ui/VUpload.java | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/client/src/main/java/com/vaadin/client/ui/VUpload.java b/client/src/main/java/com/vaadin/client/ui/VUpload.java index 56532b4a19..2f4b62a47f 100644 --- a/client/src/main/java/com/vaadin/client/ui/VUpload.java +++ b/client/src/main/java/com/vaadin/client/ui/VUpload.java @@ -121,6 +121,8 @@ public class VUpload extends SimplePanel { private boolean immediateMode; + private String acceptMimeTypes; + private Hidden maxfilesize = new Hidden(); /** For internal use only. May be removed or replaced in the future. */ @@ -254,6 +256,9 @@ public class VUpload extends SimplePanel { fu = new VFileUpload(); fu.setName(paintableId + "_file"); fu.getElement().setPropertyBoolean("disabled", !enabled); + if (acceptMimeTypes != null && !acceptMimeTypes.isEmpty()) { + InputElement.as(fu.getElement()).setAccept(acceptMimeTypes); + } panel.add(fu); panel.add(submitButton); if (isImmediateMode()) { @@ -424,5 +429,6 @@ public class VUpload extends SimplePanel { } else { InputElement.as(fu.getElement()).setAccept(acceptMimeTypes); } + this.acceptMimeTypes = acceptMimeTypes; } } |