gpt4 book ai didi

javascript - Fineuploader 在用户响应文件提交后取消上传

转载 作者:行者123 更新时间:2023-11-28 02:06:43 26 4
gpt4 key购买 nike

我正在尝试获取用户对文件提交的响应以取消或不取消文件上传,但它似乎并没有停止文件上传,可能是我遗漏了一些内容,请建议

onSubmit: function(id, name) {
doc_status = $('#doc_attach_status').val();
if (doc_status == "true" ) {

if(confirm("Please note, if you upload a new PDF, old one will be replaced") == false){

manualuploader.cancelAll(); // tried but does not work
cancelAll();// tried but does not work
cancel(id);// tried but does not work
$(this).cancelAll();// tried but does not work
}

}

},

是的,我能够成功上传文件......

这是我正在使用的完整功能...

var manualuploader = new qq.FineUploader({
callbacks : {
onComplete : function(id, name, response) {
}
},
element : $('#pdf-fine-uploader')[0],
request : {

endpoint : "/UploadPdf",
params : {
variant_id : $('#variant_id').val(),
}
},
multiple : false,
autoUpload : true,
text : {
uploadButton : '<i class="icon-plus icon-white"></i> Select File </br> Maximum upload size less than 2 MB'
},
validation : {
allowedExtensions : ['pdf', 'txt'],
//sizeLimit: 51200, // 50 kB = 50 * 1024 bytes
sizeLimit : 2097152//, // 2 MB = 2 * 1024 * 1024 bytes
//itemLimit : 6
},
callbacks : {

onSubmit: function(id, name) {
doc_status = $('#doc_attach_status').val();
// var answer = confirm("Please note, if you upload a new PDF, your current Tasting Notes PDF will be replaced");
if (doc_status == "true" ) {

if(confirm("Please note, if you upload a new PDF, your current Tasting Notes PDF will be replaced") == false){

manualuploader.cancelAll();

}

}

},
onComplete : function(id, fileName, responseJSON) {
if (responseJSON.success) {
$('.doc_link').html(responseJSON.docurl);
$('#doc_delete_link').addClass('icon-remove-sign');
$('.doc_description_head').show();
$('#doc_pdf_head').show();
$('.doc_description_div').show();
$('.description_save').show();
$('#doc_delete_link').show();
}
}

}

});
$('#triggerUpload').click(function() {
manualuploader.uploadStoredFiles();
});

});

最佳答案

终于得到了非常简单的解决方案......

只需使用

获得用户响应后返回 true 或 false ....

onSubmit: function(id, name) {
doc_status = $('#doc_attach_status').val();
if (doc_status == "true" ) {

if(confirm("Please note, if you upload a new PDF, old one will be replaced") == false){

retutn false;
}

}

},

关于javascript - Fineuploader 在用户响应文件提交后取消上传,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17668463/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com