Private
Public Access
1
0

processes files > 1 MB offline

This commit is contained in:
Sander Roosendaal
2017-11-02 15:53:54 +01:00
parent c871d69097
commit c974927192
6 changed files with 129 additions and 29 deletions

View File

@@ -4,8 +4,35 @@
{% block title %}File loading{% endblock %}
{% block meta %}
<script type='text/javascript'
src='https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js'>
</script>
<script type='text/javascript'
src='http://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js'>
</script>
<script>
$(document).ready(function() {
$('#id_file').on('change', function(evt) {
var f = this.files[0];
console.log(f);
if (f.size > 4194304) {
alert("File Size must be smaller than 4 MB");
this.value = null;
}
if (f.size > 1048576) {
$('#id_offline').val('True');
console.log("Set offline to True");
$('#extra_message').text('Because of the large size, the file will be processed offline. You will receive email when it is done. The extra actions will not be performed.');
$('#extra_message').addClass('message');
}
});
});
</script>
{% endblock %}
{% block content %}
<form enctype="multipart/form-data" action="{{ formloc }}" method="post">
<form id="file_form" enctype="multipart/form-data" action="{{ formloc }}" method="post">
<div id="left" class="grid_6 alpha">
<h1>Upload Workout File</h1>
{% if user.is_authenticated and user|is_manager %}