summaryrefslogtreecommitdiffstats
path: root/data/js/script.js
diff options
context:
space:
mode:
Diffstat (limited to 'data/js/script.js')
-rw-r--r--data/js/script.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/data/js/script.js b/data/js/script.js
index e49733b97..b9f60ceea 100644
--- a/data/js/script.js
+++ b/data/js/script.js
@@ -55,6 +55,21 @@
return this;
});
+ // check file size before uploading if browser support html5
+ if (window.File && window.FileList) {
+ function checkFileUpload(evt) {
+ var f = evt.target.files[0];
+ if (f.size > max_upload_size) {
+ document.getElementById('upload_button').innerHTML = "File too big";
+ document.getElementById('upload_button').disabled = true;
+ } else {
+ document.getElementById('upload_button').innerHTML = "Upload it!";
+ document.getElementById('upload_button').disabled = false;
+ }
+ }
+
+ document.getElementById('file').addEventListener('change', checkFileUpload, false);
+ }
});
})(jQuery);