Commit a62f9377 authored by Georgios Ouzounis's avatar Georgios Ouzounis
Browse files

Prevent empty file uploading

parent 6ebd2211
......@@ -5,6 +5,7 @@ var UploadController = Ember.Controller.extend({
wrongExt: false,
outOfSpace: false,
tooLongName: false,
emptyFile: false,
userHasEnteredData: false,
submitDisabled: false,
enoughQuotas: false,
......@@ -15,7 +16,8 @@ var UploadController = Ember.Controller.extend({
this.setProperties({
wrongExt: false,
outOfSpace: false,
tooLongName: false
tooLongName: false,
emptyFile: false
});
var host = this.store.adapterFor('upload-app').get('host'),
......@@ -49,6 +51,9 @@ var UploadController = Ember.Controller.extend({
this.set('fileSize', file_size);
this.set('outOfSpace', true);
}
else if (file_size === 0) {
this.set('emptyFile', true);
}
else if (file.files[0].name.length > 100){
this.set('tooLongName', true);
}
......
......@@ -44,6 +44,7 @@ var UploadRoute = Ember.Route.extend(AuthenticatedRouteMixin, {
controller.set('wrongExt', false);
controller.set('outOfSpace', false);
controller.set('tooLongName', false);
controller.set('emptyFile', false);
}
});
......
......@@ -144,6 +144,12 @@
</div>
{{/if}}
{{#if emptyFile}}
<div class="alert alert-danger col-sm-6 col-sm-offset-3">
File size error. You cannot upload empty files
</div>
{{/if}}
</div><!--box-body-->
</div><!--box-->
</div><!--col-->
......
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