错误
每次上传2个或更多文件时,我都会使用Upload Collection的多次上传功能不断收到上述错误。我已经尝试了多种方法来使其工作。但目前还没有结果,从我所见,它根本不影响Upload Collection的功能。但是让我感到困扰的是它。
我的onUploadComplete代码,oUploadCollection.aItems上的循环是我尝试过但未成功的人提供的解决方法。
onUploadComplete: function(oEvent) {
var oUploadCollection = this.byId("UploadCollection");
var oData = uploadModel.oData;
var oMyFile = oEvent.getParameter("files")[0];
var docid = oEvent.getParameter('documentId');
var aTripNumber = oTripNumberModel.getProperty("/TripNumber");
var location = oEvent.getParameter("files")[0].headers.location;
var handleOverwrite = oThis.handleOverwrite(oData, oEvent);
oThis.handleOverwrite(oData, oEvent);
if(aTripNumber === ""){
var sTripIdHex = oThis.ascii_to_hexa(oEvent.getParameters().mParameters.requestHeaders[3].value.split("|")[0]);
}
else{
var sTripIdHex = "";
}
if(handleOverwrite){
var sFileName = oEvent.getParameter("files")[0].fileName;
var sDocId = oThis.ascii_to_hexa(sFileName.replace(/\./g,''));
oData.items.push({
"documentId": sDocId, // generate Id,
"fileName": oEvent.getParameter("files")[0].fileName,
"mimeType": sFileType,
"thumbnailUrl": "",
"url": location + "/$value",
"TripId": sTripIdHex,
"selected": false
});
uploadModel.refresh();
var cItems = oUploadCollection.aItems.length;
for (var i = 0; i < cItems; i++) {
if (oUploadCollection.aItems[i]._status === "uploading") {
oUploadCollection.aItems[i]._percentUploaded = 100;
oUploadCollection.aItems[i]._status = oUploadCollection._displayStatus;
oUploadCollection._oItemToUpdate = null;
break;
}
}
oUploadCollection.getBinding("items").refresh();
}
},