我正在 Tomcat 上开发一个 Web 应用程序,并且我正在使用 dropzonejs 进行客户端处理。一切正常,但是当我将其上传到 Amazon Elastic Beanstalks 并尝试上传某些内容时,它会显示进度“100 | 500”。它总是在这一点停止并在 20 多秒后被取消。
在代码中找不到问题?它在本地主机上运行良好。
Dropzone.myDropzone = false;
var size = 1;
Dropzone.options.myDropzone = {
init : function() {
var dropzone = this;
var filetogive;
var givename;
var tochange;
var overwrite = false;
this.on("addedfile", function(file) {
tochange = file.previewElement
.querySelector("[data-dz-name]");
givename = file.name;
console.log(givename);
getDokumentNamen(givename);
filetogive = file;
console.log(file);
});
$("#overwritebtn").on("click", function() {
overwrite = true;
sendfile();
$("#saveModal").modal("hide");
});
$("#uploadModal").on("hidden.bs.modal",function(){
cleardropzone();
});
$("#modalinputbtn").on("click", function() {
console.log("filetogive");
givename = $("#modalinput").val();
tochange.innerHTML = givename;
dropzone.processFile(filetogive);
$("#saveModal").modal("hide");
});
function sendfile() {
console.log("sendingstatus");
console.log(filetogive.status);
if (filetogive.status != "error") {
dropzone.processFile(filetogive);
}
}
function cleardropzone(){
dropzone.removeAllFiles();
}
this.on("renameFile", function(file) {
alert("called renameFile");
});
this.on("sending", function(file, xhr, formData) {
console.log("sending called");
formData.append("dateiname", givename);
console.log("givename:"+givename);
formData.append("overwrite", overwrite);
overwrite = false;
});
this.on("success",function(file){
console.log("success");
refreshtables();
});
this.on("complete",function(file){
console.log("complete");
refreshtables();
});
this.on("uploadprogress",function(file,progress,bytesSent){
console.log("progress: "+progress+" | "+bytesSent);
});
console.log("finished init");
},
maxFilesize : size,
paramName : "pdffile",
addRemoveLinks: true,
url : "UploadServlet",
acceptedFiles : "application/pdf,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,text/plain",
parallelUploads : 1,
autoQueue : false,
autoProcessQueue : false,
dictDefaultMessage : "Ziehe Dateien hierhin zum Hochladen",
dictFallbackMessage : "Dieser Browser wird leider nicht unterstützt",
dictFileTooBig : "Die Datei ist leider zu groß. Erlaubtes Maximum sind "+ size + " MB",
dictInvalidFileType : "Dies ist leider der falsche Dateityp. Es werden nur .pdf,.doc,.docx und .txt Dateien unterstützt"
};
编辑:更改标题