Hi..
I want to reset the multiple file input field.
Actually my file input field is an array.
I used the following code and it works if the input field is not an array.
<script>
$(function()
{
$('input[type=file]').change(function ()
{
var regex = new RegExp("(.*?)\.(jpg|jpeg|png|pdf)$");
var f = this.files[0];
$.each(this.files, function (index, file)
{
fileName = file.name;
fileName =fileName.toLowerCase();
if(!(regex.test(fileName)))
{
$(this).val('');
alert('JPG/PNG/PDF files Only');
}
});
});
</script>
<form>
<input type=file style="width:100%" id='filename' name='filename[]' multiple="multiple" />
</form>
Please help me to find a solution for this.