$(function() {
    var fileText;

    var maxFileSizeInBytes = 100000; // 100kB
    $('#inputFile').change(function () {
        fileText = null;
        $('#inputFileResult').hide();

        var file = this.files[0];

        if (file.type != 'text/plain' && file.type != '') {
            $.bootstrapGrowl('Only plain text files are allowed', {
                type: 'danger'
            });
            $('#inputFile').val(null);
            return;
        }

        if (file.size > maxFileSizeInBytes) {
            $.bootstrapGrowl('File is too big', {
                type: 'danger'
            });
            $('#inputFile').val(null);
            return;
        }

        var fileReader = new FileReader();
        fileReader.readAsText(file);

        fileReader.onload = function(event) {
            fileText = event.target.result;
            $('#inputFileResult').html(fileText.replace(/\n/g, '<br>'));
            $('#inputFileResult').show();
        }

        fileReader.onerror = function(event) {
            $.bootstrapGrowl('Something went wrong', {
                type: 'danger'
            });
            $('#inputFile').val(null);
            $('#inputFileResult').hide();
        }
    });

    $('#fileUploadSubmit').click(function() {
        if (fileText == null) {
            $.bootstrapGrowl('Choose a file', {
                type: 'danger'
            });
        } else {
            $.post('upload', {text : fileText}, function(data) {
                console.log(data);
            });
        }
    });
});

@@ -1407,16 +1407,81 @@
  else %7B%0A
+            $('#fileUploadSubmit').prop('disabled', 'disabled');%0A
         
@@ -1506,17 +1506,16 @@
 ', %7Btext
- 
 : fileTe
@@ -1527,21 +1527,18 @@
 function
+ 
 (
-data
 ) %7B%0A    
@@ -1553,25 +1553,34 @@
     
-console.log(data)
+window.location.href = '/'
 ;%0A  

Disable button after upload has started (it can last for some time). Redirect to home page after upload completed.