Finish of Multiple file upload

可紊 提交于 2019-12-01 15:57:27

Please have a look at the "stop" callback option:

.bind('fileuploadstop', function (e) {/* ... */})

And If you want to track uploaded files try to use this:

$('#fileupload').bind('fileuploaddone', function (e, data) { }

Your collections data.files only contain 1 object each, hence you can track the count of files been uploaded.

Yes, you can call it API to track the end of a multiple upload process:

var $fileInput = $('#fileupload');

$fileInput.on('fileuploaddone', function(e, data) {
    var activeUploads = $fileInput.fileupload('active');
    /*
     * activeUploads starts from the max number of files you are uploading to 1 when the last file has been uploaded.
     * All you have to do is doing a test on it value.
     */
    if(activeUploads == 1) {
        console.info("All uploads done");
        // Your stuff here
    }
}

Just on this guys, you can get the number of active uploads using the below:

var activeUploads = $('#fileuploadForm').fileupload('active');

See: https://github.com/blueimp/jQuery-File-Upload/wiki/API#retrieving-the-number-of-active-uploads

I was going to use a counter on always callback function to compare to this variable. But stop looks like it works perfectly.

Just want to clarify. If i have multiple singular file upload requests is stop() the best approach?

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!