这是我的dropzone配置。我可以清楚地看到我在url部分中设置了一个URL。但是,当我运行代码时,出现“未提供URL”错误。
我已经阅读到$ {document).ready()上方的Dropzone.autoDiscover = false可能会有所帮助,但到目前为止,它仅消除了错误,而我的dropzone容器不起作用,即不可点击
$("#dropzone").dropzone({
url: "@Url.Action("Save", "AnnouncementAttachments", new { area = "Messages" })",
autoProcessQueue: false,
addRemoveLinks: true,
maxFiles: 1,
uploadMultiple: false,
parallelUploads: 1,
init: function () {
var submitButton = document.querySelector("#submit");
var token = $('input[name="__RequestVerificationToken"]').val();
var wrapperThis = this;
submitButton.addEventListener("click", function (e) {
wrapperThis.processQueue();
e.preventDefault();
e.stopPropagation();
e.stopImmediatePropagation();
return false;
});
this.on('sending', function (data, xhr, formData) {
formData.append("__RequestVerificationToken", token);
});;
this.on('error', function (file, message) {
wrapperThis.disable();
});
this.on('success', function (file,message) {
$(".dz-remove").hide();
wrapperThis.disable();
$(document).off("submit");
});
}
});
<div id="dropzone" name="Files" class="dropzone form-group"></div>