Commit 2fd02294 authored by Ningxin Hu's avatar Ningxin Hu

Check files uploaded by user

parent 18c1e320
......@@ -98,8 +98,11 @@ function Utils(errorOutputId) { // eslint-disable-line no-unused-vars
this.addFileInputHandler = function(fileInputId, canvasId) {
let inputElement = document.getElementById(fileInputId);
inputElement.addEventListener('change', (e) => {
let imgUrl = URL.createObjectURL(e.target.files[0]);
self.loadImageToCanvas(imgUrl, canvasId);
let files = e.target.files;
if (files.length > 0) {
let imgUrl = URL.createObjectURL(files[0]);
self.loadImageToCanvas(imgUrl, canvasId);
}
}, false);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment