added functionality to cancel uploads

This commit is contained in:
Abhinav Adduri 2017-07-18 10:52:32 -07:00
parent b805c78a9a
commit cc35206ee4
4 changed files with 28 additions and 5 deletions

View file

@ -79,8 +79,7 @@ $(document).ready(function() {
$('.upload-window').removeClass('ondrag');
$('#page-one').show();
});
//cancel the upload
$('#cancel-upload').click(() => {});
// on file upload by browse or drag & drop
function onUpload(event) {
event.preventDefault();
@ -93,6 +92,12 @@ $(document).ready(function() {
const expiration = 24 * 60 * 60 * 1000; //will eventually come from a field
const fileSender = new FileSender(file);
$('#cancel-upload').click(() => {
fileSender.cancel();
location.reload();
notify('Your upload was cancelled.');
});
fileSender.on('progress', progress => {
$('#page-one').hide();
$('#upload-error').hide();