I'm using the jQuery Validation plugin to limit the user to certain file types. As of now, it accepts any and all files, no matter what I do. I call it like this:
$("#untForm").validate({
ignore: [],
rules: {
fileName: {
required: false,
extension: "jpg|gif|png|mov|avi|pdf"
}
}
});
and here is part of my form:
<input type="file" class="file_input_hidden" name="attachment" id="attachment" onchange="javascript: document.getElementById('fileName').value = this.value" />
I've also tried this:
<input type="file" class="file_input_hidden" name="attachment" id="attachment" onchange="javascript: document.getElementById('fileName').value = this.value" accept=" "image/x-jpg, image/x-png, image/x-gif, application/pdf" />
In the case below, if I use the extension parameter, it accepts any type of file!
$("#untForm").validate({
ignore: [],
rules: {
fileName: {
required: false,
extension: "png|jpe?g|gif"
}
}
});
Does anyone see anything wrong?