gpt4 book ai didi

javascript - Fine Uploader 上传成功后重试

转载 作者:行者123 更新时间:2023-12-03 06:26:14 26 4
gpt4 key购买 nike

我正在使用很好的 uploader ,它运行得很好。现在,即使上传成功,它也会重试。这样一来,我就有了四个文件,而不是只有一个。

http://fineuploader.com/

我的代码:

<!-- The element where Fine Uploader will exist. -->
<div id="qq-drop-zone">
<div id="fine-uploader"></div>
<span class="dragndrop">Drag and Drop</span>
</div>

<!-- Fine Uploader -->
<script src="/modules/fine-uploader/fine-uploader.min.js" type="text/javascript"></script>

<script type="text/template" id="qq-template">
<div class="qq-uploader-selector qq-uploader" qq-drop-area-text="Drop files here">
<div class="qq-total-progress-bar-container-selector qq-total-progress-bar-container">
<div role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" class="qq-total-progress-bar-selector qq-progress-bar qq-total-progress-bar"></div>
</div>
<div class="qq-upload-drop-area-selector qq-upload-drop-area" qq-hide-dropzone>
<span class="qq-upload-drop-area-text-selector"></span>
</div>
<div class="button qq-upload-button-selector qq-upload-button">
<div>Upload From Your</div>
</div>
<span class="qq-drop-processing-selector qq-drop-processing">
<span>Processing dropped files...</span>
<span class="qq-drop-processing-spinner-selector qq-drop-processing-spinner"></span>
</span>
<ul class="qq-upload-list-selector qq-upload-list" aria-live="polite" aria-relevant="additions removals">
<li class="clearfix">
<img class="qq-thumbnail-selector" qq-max-size="100" qq-server-scale>
<div class="qq-progress-bar-container-selector">
<div role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" class="qq-progress-bar-selector qq-progress-bar"></div>
</div>
<span class="qq-upload-spinner-selector qq-upload-spinner"></span>
<div class="form">
<div class="input_block caption">
<label for="caption">Caption</label>
<input type="text" class="caption_input" data-key="title" placeholder="" />
</div>
<div class="input_block qq-hide">
<span class="qq-edit-filename-icon-selector qq-edit-filename-icon" aria-label="Edit filename"></span>
</div>
</div>
<div class="file_data">
<span class="qq-upload-file-selector qq-upload-file"></span>
<input class="qq-edit-filename-selector qq-edit-filename" tabindex="0" type="text">
<span class="qq-upload-size-selector qq-upload-size"></span>
</div>
<button type="button" class="ghost button qq-btn qq-upload-cancel-selector qq-upload-cancel">Cancel</button>
<button type="button" class="ghost button qq-btn qq-upload-retry-selector qq-upload-retry">Retry</button>
<button type="button" class="button qq-btn qq-upload-delete-selector qq-upload-delete">Delete</button>
<span role="status" class="qq-upload-status-text-selector qq-upload-status-text"></span>
</li>
</ul>

<dialog class="qq-alert-dialog-selector">
<div class="qq-dialog-message-selector"></div>
<div class="qq-dialog-buttons">
<button type="button" class="button qq-cancel-button-selector">Close</button>
</div>
</dialog>

<dialog class="qq-confirm-dialog-selector">
<div class="qq-dialog-message-selector"></div>
<div class="qq-dialog-buttons">
<button type="button" class="ghost button qq-cancel-button-selector">No</button>
<button type="button" class="button qq-ok-button-selector">Yes</button>
</div>
</dialog>

<dialog class="qq-prompt-dialog-selector">
<div class="qq-dialog-message-selector"></div>
<input type="text">
<div class="qq-dialog-buttons">
<button type="button" class="ghost button qq-cancel-button-selector">Cancel</button>
<button type="button" class="button qq-ok-button-selector">Ok</button>
</div>
</dialog>
</div>
</script>

<script>
var dragAndDropModule = new qq.DragAndDrop({
dropZoneElements: [document.getElementById('qq-drop-zone')],
classes: {
dropActive: "dragover"
},
callbacks: {
processingDroppedFiles: function() {},
processingDroppedFilesComplete: function(files, dropTarget) {
fineUploaderBasicInstance.addFiles(files); //this submits the dropped files to Fine Uploader
}
}
}),
fineUploaderBasicInstance = new qq.FineUploader({
debug: true,
element: document.getElementById('fine-uploader'),
request: {
endpoint: '/ajax/fine-uploader.php'
},
retry: {
enableAuto: true
}
});
</script>

希望有帮助

最佳答案

XHR 响应文本中存在额外文本,导致 JSON 无效。如果没有有效的响应,它会注册为上传失败并开始重试。我删除了多余的文本,它又可以工作了。

关于javascript - Fine Uploader 上传成功后重试,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38645504/

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