From 2b56ec679086c7657ff748b708d1ecda2c882f9a Mon Sep 17 00:00:00 2001 From: Iuri Matias Date: Wed, 12 Oct 2016 20:01:21 -0400 Subject: [PATCH] add file check to upload --- js/build/embark.bundle.js | 4 ++++ js/embark.js | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/js/build/embark.bundle.js b/js/build/embark.bundle.js index 2bf77b3b7..380fc0cbf 100644 --- a/js/build/embark.bundle.js +++ b/js/build/embark.bundle.js @@ -146,6 +146,10 @@ var EmbarkJS = var self = this; var file = inputSelector[0].files[0]; + if (file === undefined) { + throw new Error('no file found'); + } + var promise = new Promise(function(resolve, reject) { var reader = new FileReader(); reader.onloadend = function() { diff --git a/js/embark.js b/js/embark.js index 0fdc92b50..c222cbfc7 100644 --- a/js/embark.js +++ b/js/embark.js @@ -99,6 +99,10 @@ EmbarkJS.Storage.uploadFile = function(inputSelector) { var self = this; var file = inputSelector[0].files[0]; + if (file === undefined) { + throw new Error('no file found'); + } + var promise = new Promise(function(resolve, reject) { var reader = new FileReader(); reader.onloadend = function() {