X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/205ab78251b8219e78b684d15adafb72720003d8..5d78f2b7af4ee0f1aa48f1e2538ef40ea6b19b00:/stage2/static/js/checkfile.js diff --git a/stage2/static/js/checkfile.js b/stage2/static/js/checkfile.js index 36afefc..19db762 100644 --- a/stage2/static/js/checkfile.js +++ b/stage2/static/js/checkfile.js @@ -14,14 +14,15 @@ $(function() { alert('Błędne rozszerzenie! Powinno być: ' + ext); ok = false; } - if (name.length > 100) { - alert('Za długa nazwa pliku! Maksymalna długość: 100 znaków (jest: ' + name.length + ')'); + if (name.length > 65) { + alert('Za długa nazwa pliku! Maksymalna długość: 65 znaków (jest: ' + name.length + ')'); ok = false; } } + var max_size = this.getAttribute('data-max') || 20; var size = this.files[0].size; - if (size > 20 * 1024 * 1024) { - alert('Rozmiar pliku nie może przekraczać 20 MB!'); + if (size > max_size * 1024 * 1024) { + alert('Rozmiar pliku nie może przekraczać ' + max_size + ' MB!'); ok = false; } if (!ok) {