Skip to content

Instantly share code, notes, and snippets.

@Cvetomird91
Created May 16, 2017 09:11
Show Gist options
  • Save Cvetomird91/8e1c8c63e7c66f6f13e332056add0b2f to your computer and use it in GitHub Desktop.
Save Cvetomird91/8e1c8c63e7c66f6f13e332056add0b2f to your computer and use it in GitHub Desktop.
<!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