php - jQuery Validate MultIple File Upload -
i trying validate html file upload using jquery validate plugin,
my html form is,
<form id="formid" action="welcome/test_up" method="post" enctype="multipart/form-data"> <input type="file" name="myfile[]" id="myfile" multiple> <input type="submit" name="submit" id="submit" value="submit"/>
and i'm using jquery validation plugin as,
$('#formid').validate({ rules: { inputimage: { required: true, accept: "png|jpe?g|gif" } }, messages: { inputimage: "file must jpg, gif or png" } });
but unfortunately it's not working,
it's working if use name="myfile"
not when use name="myfile[]"
any idea solve ?
try set rule in input tag become
<input type="file" name="myfile[]" id="myfile" accept="png|jpe?g|gif" multiple>
so js only
$('#formid').validate();
Comments
Post a Comment