diff options
Diffstat (limited to 'data')
-rw-r--r-- | data/js/script.js | 15 | ||||
-rw-r--r-- | data/js/upload_form.js | 16 |
2 files changed, 15 insertions, 16 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); diff --git a/data/js/upload_form.js b/data/js/upload_form.js deleted file mode 100644 index 111747c67..000000000 --- a/data/js/upload_form.js +++ /dev/null @@ -1,16 +0,0 @@ -// 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); -} - |