summaryrefslogtreecommitdiffstats
path: root/data/js/upload_form.js
blob: 7a71a5174d8fd46f24820b74811e9a9ff3a5fea9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
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);
}