我的配置。 Angular:1.6,后端:C#,Fine Uploader 5.
我的上传工作正常,但新要求是上传整个文件夹,暂停并继续功能。
最初,当文件夹被删除时,它应处于暂停状态,并且必须有一个上传按钮才能继续。
我试图用autoUpload: false
完成它,但它也无效。
当我尝试继续上传时,它会显示Ignoring continue for file ID 0 (om.jpg). Not paused.
我的代码:
angular.module("fineUploaderDirective", [])
.directive("fineUploader", function ($compile, $interpolate) {
return {
restrict: "A",
replace: true,
link: function ($scope, element, attrs) {
var endpoint = attrs.uploadServer,
notAvailablePlaceholderPath = attrs.notAvailablePlaceholder,
waitingPlaceholderPath = attrs.waitingPlaceholder,
acceptFiles = attrs.allowedMimes,
sizeLimit = attrs.maxFileSize,
largePreviewSize = parseInt(attrs.largePreviewSize),
allowedExtensions = JSON.parse(attrs.allowedExtensions),
previewDialog = document.querySelector('.large-preview'),
uploader = new qq.FineUploader({
debug: true,
element: element[0],
request: { endpoint: endpoint },
validation: {
acceptFiles: acceptFiles,
allowedExtensions: allowedExtensions,
sizeLimit: sizeLimit
},
deleteFile: {
endpoint: endpoint,
enabled: true
},
thumbnails: {
placeholders: {
notAvailablePath: notAvailablePlaceholderPath,
waitingPath: waitingPlaceholderPath
}
},
display: {
prependFiles: true
},
failedUploadTextDisplay: {
mode: "custom"
},
retry: {
enableAuto: true
},
chunking: {
enabled: true
},
resume: {
enabled: true
},
callbacks: {
//onSubmit: function (id, name) {
// debugger
// return new Promise(function (resolve, reject) {
// debugger
// // popup modal
// // when user responds...
// // ...call resolve() if they want to upload the file
// // ...or reject() if they want to cancel the file
// resolve()
// });
//},
onSubmitted: function (id, name) {
var fileEl = this.getItemByFileId(id),
thumbnailEl = fileEl.querySelector('.thumbnail-button');
//thumbnailEl.addEventListener('click', function () {
// openLargerPreview($scope, uploader, previewDialog, largePreviewSize, id);
//});
},
onSubmitDelete: function (id) {
this.setDeleteFileParams({ filename: this.getName(id) }, id)
},
onResume: function (id) {
alert(1)
}
}
});
dialogPolyfill.registerDialog(previewDialog);
$scope.closePreview = closePreview.bind(this, previewDialog);
bindToRenderedTemplate($compile, $scope, $interpolate, element);
}
}
});
那么,如何暂停所有删除的文件最初,然后在用户命令时恢复。
提前致谢。