summaryrefslogtreecommitdiffstats
path: root/data/js/script.js
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2012-10-22 17:41:42 +0200
committerFlorian Pritz <bluewind@xinu.at>2012-10-22 22:39:20 +0200
commit96245818a67c6a51ba5c7a5cd70c33cbc5589055 (patch)
treed1f2b6ab9a082acd5e6c12c8c9a222a9b25f0e5b /data/js/script.js
parentc64aa75262a39aa5f92c4ee601229058b594d32f (diff)
Merge upload_form.js into script.js
Signed-off-by: Florian Pritz <bluewind@xinu.at>
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);