some more sofistication in the upload form
This commit is contained in:
@@ -15,12 +15,28 @@
|
||||
$(document).ready(function() {
|
||||
$('#id_file').on('change', function(evt) {
|
||||
var f = this.files[0];
|
||||
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(f);
|
||||
if (f.size > 4194304) {
|
||||
alert("File Size must be smaller than 4 MB");
|
||||
console.log(size1)
|
||||
console.log(size2)
|
||||
if (f.size > size1) {
|
||||
alert("File Size must be smaller than 10 MB");
|
||||
this.value = null;
|
||||
}
|
||||
if (f.size > 1048576) {
|
||||
if (f.size > size2) {
|
||||
$('#id_offline').val('True');
|
||||
$('#id_offline').prop('checked','True');
|
||||
console.log("Set offline to True");
|
||||
|
||||
Reference in New Issue
Block a user