FileUploaderBasic 버전을 사용하고 있으며 동일한 문제에 직면했습니다. 그래서 나는 DIY 여기
전체 예입니다 제거 않았다
이
var $fub = $('#fine-uploader-basic'),
$messages = $('#upload-messages');
// try the basic uploader
var uploader = new qq.FileUploaderBasic({
button: $fub[0],
action: base_ajax_url + 'upload',
debug: true,
autoUpload: false,
allowedExtensions: ['jpeg', 'jpg', 'gif', 'png'],
sizeLimit: 204800, // 200 kB = 200 * 1024 bytes
// the method name really should be onSelect
onSubmit: function(id, fileName) {
var _self = this;
var entry = $('<div id="file-' + id + '" class="alert" style="margin: 10px 0 0">' + fileName + ' <span class="qq-upload-cancel close">×</span></div>'
).appendTo(
$messages[0]
).find('.qq-upload-cancel').click(function() {
_self._storedFileIds.splice(_self._storedFileIds.indexOf(id) , 1);
$($(this).parent()).remove();
return false;
});
},
onUpload: function(id, fileName) {
$('#file-' + id).addClass('alert-info')
.html('<img src="/sites/all/themes/pb_admin/images/loading.gif" alt="Initializing. Please hold."> ' +
'Initializing ' +
'"' + fileName + '"');
},
onProgress: function(id, fileName, loaded, total) {
if (loaded < total) {
progress = Math.round(loaded/total * 100) + '% of ' + Math.round(total/1024) + ' kB';
$('#file-' + id).removeClass('alert-info')
.html('<img src="/sites/all/themes/pb_admin/images/loader.gif" alt="In progress. Please hold."> ' +
'Uploading ' +
'"' + fileName + '" ' +
progress);
} else {
$('#file-' + id).addClass('alert-info')
.html('<img src="/sites/all/themes/pb_admin/images/loader.gif" alt="Saving. Please hold."> ' +
'Saving ' +
'"' + fileName + '"');
}
},
onComplete: function(id, fileName, responseJSON) {
if (responseJSON.success) {
$('#file-' + id).removeClass('alert-info')
.addClass('alert-success')
.html('<i class="icon-ok"></i> ' +
'Successfully saved ' +
'"' + fileName + '"');
} else {
$('#file-' + id).removeClass('alert-info')
.addClass('alert-error')
.html('<i class="icon-exclamation-sign"></i> ' +
'Error with ' +
'"' + fileName + '": ' +
responseJSON.error);
}
}
});
(이름은 ... 어쨌든 좀 의심 onSubmit)
난으로 onCancel 메소드를 호출하려고 (하지만 예외를 던져 그 정의되지 않음).
그러면이 코드는 _storedFileIds 배열에서 ID를 제거하여 작동합니다. 그리고 그게 다야.