mirror of https://github.com/embarklabs/embark.git
add file check to upload
This commit is contained in:
parent
fe926382ce
commit
2b56ec6790
|
@ -146,6 +146,10 @@ var EmbarkJS =
|
||||||
var self = this;
|
var self = this;
|
||||||
var file = inputSelector[0].files[0];
|
var file = inputSelector[0].files[0];
|
||||||
|
|
||||||
|
if (file === undefined) {
|
||||||
|
throw new Error('no file found');
|
||||||
|
}
|
||||||
|
|
||||||
var promise = new Promise(function(resolve, reject) {
|
var promise = new Promise(function(resolve, reject) {
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
reader.onloadend = function() {
|
reader.onloadend = function() {
|
||||||
|
|
|
@ -99,6 +99,10 @@ EmbarkJS.Storage.uploadFile = function(inputSelector) {
|
||||||
var self = this;
|
var self = this;
|
||||||
var file = inputSelector[0].files[0];
|
var file = inputSelector[0].files[0];
|
||||||
|
|
||||||
|
if (file === undefined) {
|
||||||
|
throw new Error('no file found');
|
||||||
|
}
|
||||||
|
|
||||||
var promise = new Promise(function(resolve, reject) {
|
var promise = new Promise(function(resolve, reject) {
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
reader.onloadend = function() {
|
reader.onloadend = function() {
|
||||||
|
|
Loading…
Reference in New Issue