1

jquery-file-upload API plugin にカスタム ボタンを追加したいと考えています。すべてのファイルがアップロードされると、このボタンが有効になり、ファイルがないか、アップロードされたファイルがない場合、ボタンは無効のままになります。ボタンが必要なので、アップロードが完了すると、ユーザーのみが終了ボタンをクリックできます。それ以外の場合は無効のままです。

助けてください !!:(

4

1 に答える 1

0

これを試して、カスタム ボタンを fileupload html 内に追加し、無効にします。

<div class="span7">
                    <span class="fileinput-button ufloat">
                        <span class="icon icon-plus"></span>
                        <span class="upload_txt">choose file to upload</span>
                        <input type="file" multiple="multiple" size="1"/>
                    </span>
                    <button type="submit" id="uploadBtn" class="btn-primary start">
                        <i class="icon icon-upload"></i>
                        <span>Upload</span>
                    </button>
                    <button type="reset" id="cancelBtn" class="btn-primary cancel">
                        <i class="icon icon-ban-circle"></i>
                        <span>cancel</span>
                    </button>

                    <!-- Adding your custom button -->
                    <button id="customBtn" disabled="true"></button>
                </div>

main.js で、これを完了関数に追加します。

$('#fileuploadbasic').fileupload({
         done: function{
                  var filess= data.files[0];
            var filenam = filess.name;
            data.context.text('');
            $(data.context).append('<td class="name" colspan="6">'+filenam+' uploaded Success</td>');

// after finish upload and there are no other files to upload make
// make custom button enabled
if( $('tbody tr.template-upload td.start').length == 0) {
    $('#customBtn').removeAttr('disabled');
}
         }
});
于 2013-03-18T10:55:41.927 に答える