summaryrefslogtreecommitdiffstats
path: root/data/js
diff options
context:
space:
mode:
Diffstat (limited to 'data/js')
-rw-r--r--data/js/upload_form.js16
1 files changed, 16 insertions, 0 deletions
diff --git a/data/js/upload_form.js b/data/js/upload_form.js
new file mode 100644
index 000000000..7a71a5174
--- /dev/null
+++ b/data/js/upload_form.js
@@ -0,0 +1,16 @@
+// 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').value = "File too big";
+ document.getElementById('upload_button').disabled = true;
+ } else {
+ document.getElementById('upload_button').value = "Upload";
+ document.getElementById('upload_button').disabled = false;
+ }
+ }
+
+ document.getElementById('file').addEventListener('change', checkFileUpload, false);
+}
+