Created
May 16, 2017 09:11
-
-
Save Cvetomird91/8e1c8c63e7c66f6f13e332056add0b2f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Problem</title> | |
<script> | |
window.addEventListener('load', function(event) { | |
var form = document.getElementById('uploader'); | |
var file_upload = document.getElementById('file_upload'); | |
form.addEventListener('submit', function(e) { | |
e.preventDefault(); | |
if (file_upload.files.length === 0) { | |
window.alert('not enough files!'); | |
} | |
if(file_upload.files.length > 0) { | |
this.submit(); | |
} | |
}); | |
}); | |
</script> | |
</head> | |
<body> | |
<form id='uploader' onsubmit=''> | |
<input type="file" name="files" id="file_upload" multiple /> | |
<input type="submit" value="Upload Filles" id='submit_files' /> | |
</form> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment