gpt4 book ai didi

node.js - 使用 dropzone 失败后如何重新上传?

转载 作者:行者123 更新时间:2023-12-01 22:25:21 24 4
gpt4 key购买 nike

我正在使用 dropzone 上传文件,我发现了一个问题。

所以我通过拖放区选择了一张图片并点击上传(我使用的是autoProcessQueue:false)

并假设上传失败。图片上方会有错误标记。

然后我再次点击上传。通过查看开发人员工具栏,我看到 formdata.files 是空的。没有文件正在上传到服务器。

这是一个错误吗?失败后如何重新上传图片?

最佳答案

代码取自 https://github.com/enyo/dropzone/issues/617 .问题是错误的,file.status 没有更新为 Dropzone.QUEUED。

view.dropzone = new Dropzone(form[0], {
...
autoProcessQueue: false,
uploadMultiple: false,
parallelUploads: 100,
maxFiles: 1,
thumbnailWidth: 300,
thumbnailHeight: null,
previewsContainer: inputPreview[0],
clickable: inputClick[0],
acceptedFiles: 'image/*',
...
error: function(file, errorMessage, xhr) {

// Trigger an error on submit
view.onSubmitComplete({
file: file,
xhr: xhr
});

// Allow file to be reuploaded !
file.status = Dropzone.QUEUED;
// this.cancelUpload(file);
// this.disable();
// this.uploadFile(file);

}
});

关于node.js - 使用 dropzone 失败后如何重新上传?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35762139/

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