0

我正在使用 Jquery File Uploadify 插件进行文档上传,它有多个true,当我在 OnComplete 函数中使用警报时,在上传文档时显示多个警报..

function loadSwf(){    
    $("#fileuploader").fileUpload({
            'uploader':  "@Url.Content("~/Scripts/FileUpload/uploader.swf")",
            'cancelImg':  "@Url.Content("~/Content/Images/clearBtn.png")",
            'buttonText': 'Browse Files',
            //'buttonImg' : "@Url.Content("~/Content/Images/attachDoc.png")",
            'script': "@Url.Content("~/Documents/Upload/")",   
            'folder': "@Url.Content("~/Documents/")",
            //'fileDesc': 'Documents Files',
            'fileExt': '*.pdf;*.doc;*.ppt;*.xls',
            'multi': true,
            'auto': false,                 
            'scriptData': {'ActivityID': $('[id="ActivityID"]').val(), 'Description' :  "test" },
            'onComplete': function(settings, data) {  
             alert("File Uploaded Successfully");
        }
        });
}

此代码适用于上传一个文件。但是当我上传多个文件时,我会收到每个文件的警报消息!如何在上传所有文件后仅获取一次警报消息,而不是每个文件一个警报。

4

1 回答 1

1

您需要使用onQueueComplete事件

$("#fileuploader").fileUpload({
    'uploader':  "@Url.Content("~/Scripts/FileUpload/uploader.swf")",
    'cancelImg':  "@Url.Content("~/Content/Images/clearBtn.png")",
    'buttonText': 'Browse Files',
    //'buttonImg' : "@Url.Content("~/Content/Images/attachDoc.png")",
    'script': "@Url.Content("~/Documents/Upload/")",   
    'folder': "@Url.Content("~/Documents/")",
    //'fileDesc': 'Documents Files',
    'fileExt': '*.pdf;*.doc;*.ppt;*.xls',
    'multi': true,
    'auto': false,                 
    'scriptData': {'ActivityID': $('[id="ActivityID"]').val(), 'Description' :  "test" },
        'onQueueComplete' : function(queueData) {
            alert("Files Uploaded Successfully");
        }
    }
});
于 2013-03-12T13:07:04.657 回答