diff --git a/rowers/templates/document_form.html b/rowers/templates/document_form.html
index c5b03d79..bd24cd6e 100644
--- a/rowers/templates/document_form.html
+++ b/rowers/templates/document_form.html
@@ -12,40 +12,6 @@
src='http://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js'>
{% endblock %}
@@ -123,6 +89,42 @@
var frm = $("#file_form");
var data = new FormData(frm[0]);
+ $('#id_file').on('change', function(evt) {
+ var f = this.files[0];
+ console.log(f);
+ var istcx = false;
+ var isgzip = false;
+ var size1 = 10485760;
+ var size2 = 1048576;
+ if ((/\.(tcx|TCX)/i).test(f.name)) {
+ istcx = true;
+ console.log('tcx');
+ if ((/\.(gz|GZ)/i).test(f.name)) {
+ isgzip = true;
+ console.log('gzip');
+ size1 /= 5;
+ size2 /= 5;
+ }
+ }
+ console.log(size1)
+ console.log(size2)
+ if (f.size > size1) {
+ alert("File Size must be smaller than 10 MB");
+ this.value = null;
+ } else {
+
+ if (f.size > size2) {
+ $('#id_offline').val('True');
+ $('#id_offline').prop('checked','True');
+ data.set($('#id_offline').attr('name'),$('#id_offline').prop('checked'));
+ console.log("Set offline to True");
+ $('#extra_message').text('Because of the large size, we recommend to use background processing. You will receive email when it is done. The extra actions will not be performed.');
+ $('#extra_message').addClass('message');
+}
+ }
+
+});
+
$('input').each(function( i ) {
$(this).change(function() {
if ($(this).attr('type') == 'checkbox') {
@@ -209,6 +211,7 @@
if (f.size > size2) {
$('#id_offline').val('True');
$('#id_offline').prop('checked','True');
+ data.set($('#id_offline').attr('name'),$('#id_offline').prop('checked'));
console.log("Set offline to True");
$('#extra_message').text('Because of the large size, we recommend to use background processing. You will receive email when it is done. The extra actions will not be performed.');
$('#extra_message').addClass('message');