admin管理员组文章数量:1414628
I've used a custom validator to validate the file extension of a file input below.
.addValidator('filetype', function(value, requirement) {
return value.split('.').pop().toLowerCase() === requirement;
})
I'd really like to get access to the actual file so I can check the MIME type. Is there a way to get a reference back to the input so I can check the actual file date?
I've used a custom validator to validate the file extension of a file input below.
.addValidator('filetype', function(value, requirement) {
return value.split('.').pop().toLowerCase() === requirement;
})
I'd really like to get access to the actual file so I can check the MIME type. Is there a way to get a reference back to the input so I can check the actual file date?
Share Improve this question asked Nov 3, 2015 at 23:58 tkiethanomtkiethanom 7172 gold badges8 silver badges21 bronze badges1 Answer
Reset to default 3Yes, the third argument is the parsley instance.
See this issue and this example
PRs for better documentation, as well as clean file validators in extra/
wele.
本文标签: javascriptHow to validate file input using Parsley JSStack Overflow
版权声明:本文标题:javascript - How to validate file input using Parsley JS? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745174232a2646158.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论