Skip to content
Snippets Groups Projects
Commit e9670fd1 authored by Emmanuel ROHEE's avatar Emmanuel ROHEE
Browse files

SYWEB-13: disabled "Send image" button if the browser does not support HTML5 file API

parent f9688d75
No related branches found
No related tags found
No related merge requests found
......@@ -31,13 +31,23 @@ angular.module('mFileInput', [])
},
link: function(scope, element, attrs, ctrl) {
element.bind("click", function() {
element.find("input")[0].click();
element.find("input").bind("change", function(e) {
scope.selectedFile = this.files[0];
scope.$apply();
// Check if HTML5 file selection is supported
if (window.FileList) {
element.bind("click", function() {
element.find("input")[0].click();
element.find("input").bind("change", function(e) {
scope.selectedFile = this.files[0];
scope.$apply();
});
});
});
}
else {
setTimeout(function() {
element.attr("disabled", true);
element.attr("title", "The app uses the HTML5 File API to send files. Your browser does not support it.");
}, 1);
}
// Change the mouse icon on mouseover on this element
element.css("cursor", "pointer");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment