JS file selection control
on first line of the code you will find "document.getElementById('userfile')" change the userfile acordingly to your ID of file input field in a form. In this case JS is set to check for documents such is .doc .docx etc and file size can't be smaller than xxx kb or bigger than xxx kb if check is OK it will allow user to submit your form if check fails then user input will be deleted and red error message will apear in ID element you have to specify - document.getElementById("wrongFile")