jQuery File Upload blueimp



我正在使用jquery模板上传blueimp文件。必须在模板中添加什么条件才能将添加次数限制为 6 ?这是模板:

<script id="template-upload" type="text/x-tmpl">
    {% for (var i=0, file; file=o.files[i]; i++) { %}
    <ul class="photogroduit template-upload fade ">
        <ul class="infosgalleries">
            <li>
                <div class="boxgallerie ">
                    <span class="preview"></span>
                    <div class="progress progress-striped active" role="progressbar" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0"><div class="progress-bar progress-bar-success" style="width:0%;"></div></div>
                    <a class="boxcontenucancel" href=""><span>P</span></a>
                    <button class="btn btn-warning cancel">
                        <i class="glyphicon glyphicon-trash"></i>
                    </button>
                </div>
            </li>
        </ul>
    </ul>
    {% } %}
</script>

我试过这个,但它不起作用: :

{% for (var i=0, file; file=o.files[i]; i++) { %}
   if(i < 6) {
       break;
   }

如果你只想要六次迭代,那么

这样做
{% var file; %}
{% for (var i=0; i < 6; i++) { %}
{%     file = o.files[i]; %}
// rest of the code

最新更新