美文网首页
Bootstrap-FileInput插件使用方法

Bootstrap-FileInput插件使用方法

作者: zxk175 | 来源:发表于2017-03-15 17:21 被阅读782次

    页面引用

    <link href="/resources/fileinput/css/fileinput.css" rel="stylesheet" type="text/css"/>
    <script src="/resources/fileinput/js/fileinput.js" type="text/javascript"></script>
    <script src="/resources/fileinput/js/locales/zh.js" type="text/javascript"></script>
    

    JavaScript

    $(function () {
            var id = '${lid}';
            $('#file-zh').fileinput({
                language: 'zh',
                uploadUrl: '/loan/upload/' + id + '.shtml',
                showPreview: false,
                elErrorContainer: "#fileError",
                browseClass: "btn btn-success btn-file btn-sm",
                browseLabel: "查找文件",
                browseIcon: '<i class="glyphicon glyphicon-search"></i>',
                removeClass: "btn btn-danger btn-file btn-sm",
                removeLabel: "清除",
                removeIcon: '<i class="glyphicon glyphicon-trash"></i>',
                uploadClass: "btn btn-info btn-file btn-sm",
                uploadLabel: "上传",
                uploadIcon: '<i class="glyphicon glyphicon-upload"></i>'
            })
                .on("fileuploaded", function (e, data) {
                    var res = data.response;
                    if (res.code == 200) {
                        location.href = res.url;
                    }
                });
        })
    

    相关文章

      网友评论

          本文标题:Bootstrap-FileInput插件使用方法

          本文链接:https://www.haomeiwen.com/subject/tzxrnttx.html