Skip to content

Commit bf2c9a1

Browse files
committed
Workaround Firefox and IE not showing file selection dialog
1 parent 15caa9c commit bf2c9a1

2 files changed

Lines changed: 12 additions & 1 deletion

File tree

GCDWebUploader/GCDWebUploader.bundle/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ <h1>%header%</h1>
6565
<div id="alerts"></div>
6666

6767
<div class="btn-toolbar">
68-
<button type="button" class="btn btn-primary fileinput-button">
68+
<button type="button" class="btn btn-primary fileinput-button" id="upload-file">
6969
<span class="glyphicon glyphicon-upload"></span> Upload Files&hellip;
7070
<input id="fileupload" type="file" name="files[]" multiple>
7171
</button>

GCDWebUploader/GCDWebUploader.bundle/js/index.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,17 @@ function _reload(path) {
178178

179179
$(document).ready(function() {
180180

181+
// Workaround Firefox and IE not showing file selection dialog when clicking on "upload-file" <button>
182+
// Making it a <div> instead also works but then it the button doesn't work anymore with tab selection or accessibility
183+
$("#upload-file").click(function(event) {
184+
$("#fileupload").click();
185+
});
186+
187+
// Prevent event bubbling when using workaround above
188+
$("#fileupload").click(function(event) {
189+
event.stopPropagation();
190+
});
191+
181192
$("#fileupload").fileupload({
182193
dropZone: $(document),
183194
pasteZone: null,

0 commit comments

Comments
 (0)