Skip to content
This repository has been archived by the owner on Jan 11, 2023. It is now read-only.

Commit

Permalink
Workaround Firefox and IE not showing file selection dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
swisspol committed Nov 7, 2014
1 parent 15caa9c commit bf2c9a1
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion GCDWebUploader/GCDWebUploader.bundle/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ <h1>%header%</h1>
<div id="alerts"></div>

<div class="btn-toolbar">
<button type="button" class="btn btn-primary fileinput-button">
<button type="button" class="btn btn-primary fileinput-button" id="upload-file">
<span class="glyphicon glyphicon-upload"></span> Upload Files&hellip;
<input id="fileupload" type="file" name="files[]" multiple>
</button>
Expand Down
11 changes: 11 additions & 0 deletions GCDWebUploader/GCDWebUploader.bundle/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,17 @@ function _reload(path) {

$(document).ready(function() {

// Workaround Firefox and IE not showing file selection dialog when clicking on "upload-file" <button>
// Making it a <div> instead also works but then it the button doesn't work anymore with tab selection or accessibility
$("#upload-file").click(function(event) {
$("#fileupload").click();
});

// Prevent event bubbling when using workaround above
$("#fileupload").click(function(event) {
event.stopPropagation();
});

$("#fileupload").fileupload({
dropZone: $(document),
pasteZone: null,
Expand Down

0 comments on commit bf2c9a1

Please sign in to comment.