I would like to validate video files with content type. This is possible for audios Link here. I don't want to validate by mentioning the extensions. But I want to validate whether the file is video file or not?? Is it possible?? or I really need to mention extension for validation.
According to Wikipedia all MIME types for videos begin with video/*
.
So you simply need to change audio/*
to video/*
:
$( "#myform" ).validate({
rules: {
field: {
required: true,
accept: "video/*"
}
}
});
Please check working example.
What about using HTML5 ? ...
<input type="file" name="video" accept="video/*">
<input type="file" name="audio" accept="audio/*">
<input type="file" name="video_audio" accept="video/*, audio/*">
for modern browsers
Doc : Input#attr-accept
so do fallback as @n1ckolas's answer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With