限制上传文件大小和格式的jQuery插件实例(2)

<input type="file"/>
@section scripts
{
    <script src="https://www.jb51.net/~/Scripts/checkFileTypeAndSize.js"></script>
    <script type="text/javascript">
        $(function() {
            $('#f').checkFileTypeAndSize({
                allowedExtensions: ['jpg'],
                maxSize: 10,
                success: function() {
                    alert('ok');
                },
                extensionerror: function() {
                    alert('允许的格式为:jpg');
                    return;
                },
                sizeerror: function() {
                    alert('最大尺寸10kb');
                    return;
                }
            });
        });
    </script>
}

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:https://www.heiqu.com/wgxywz.html