Below are the script by which you can validate file when you upload
Make the form
<form>
<div class=”form-level“>Upload Resume
<input name=”image” type=”file” id=”upload_resume” placeholder=”Upload Resume”class=”form-control” /></div>
</form>
<div class=”form-level“>Upload Resume
<input name=”image” type=”file” id=”upload_resume” placeholder=”Upload Resume”class=”form-control” /></div>
</form>
var fup = document.getElementById('upload_resume'); var fileName = fup.value; var ext = fileName.substring(fileName.lastIndexOf('.') + 1); if(ext == "doc" || ext == "docx") { return true; } else { alert("Please select your Resume. Only pdf, doc and docx files are accepted"); fup.value=""; fup.focus(); return false; } }
No comments:
Post a Comment