Disable local file upload if FileReader support is not available.
This commit is contained in:
parent
4c2624785f
commit
008c51f352
1 changed files with 20 additions and 13 deletions
|
|
@ -125,8 +125,10 @@ C1PSerialPort.prototype.setBinding = function(c, t, s, e)
|
|||
}(this);
|
||||
return true;
|
||||
case "uploadSerial":
|
||||
this.bindings[s] = e;
|
||||
// Check for availability of FileReader
|
||||
if (window.FileReader && window.File && window.FileList && window.Blob ) {
|
||||
var serial = this;
|
||||
this.bindings[s] = e;
|
||||
e.onsubmit = function (event) {
|
||||
var file = event.currentTarget[1].files[0];
|
||||
|
||||
|
|
@ -140,6 +142,11 @@ C1PSerialPort.prototype.setBinding = function(c, t, s, e)
|
|||
// Prevent reloading of web page after form submission
|
||||
return false;
|
||||
};
|
||||
}
|
||||
else {
|
||||
this.println("FileReader support not available, disabling local file upload");
|
||||
e.parentNode.removeChild(e);
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
break;
|
||||
|
|
|
|||
Loading…
Reference in a new issue