Hello all, I recently noticed that UploadCollection control was set to deprecated in favour of UploadSet control.
I am trying to switch from one to another, but it seems like an impossible task... When uploading or deleting a file uploaded I get the following error message:

this is how my uploadSet looks like in xml code:
<upload:UploadSet uploadEnabled="{= ${FormInputReady} && ${TaxStatus} !== 'M'}" beforeUploadStarts="onUploadSetChange"
afterItemRemoved="onItemRemoved" id="uploadSet" items="{path: 'toAttachments', templateShareable: false}" maxFileNameLength="200"
uploadCompleted="onUploadSetComplete" terminationEnabled="false">
<upload:UploadSetItem visibleRemove="{EntryEnabled}" visibleEdit="false" fileName="{Name}" mediaType="{Mimetype}"
url="{parts:['Area', 'Company', 'Period', 'FormId', 'IdAttachment', 'ItemId'], formatter:'.formatter.formatUploadURL' }">
<upload:attributes>
<ObjectAttribute
title="Uploaded by"
text="{UserFullname}"
active="false"/>
<ObjectAttribute
title="Uploaded on"
text="{ path: 'CreationDate', type: 'sap.ui.model.type.Date', formatOptions: { style: 'short', pattern: 'dd.MM.yyyy - HH:mm' } }"
active="false"/>
</upload:attributes>
</upload:UploadSetItem>
</upload:UploadSet>
And this is what my controller implementation looks like:
onUploadSetChange: function (oEvent) {
var oUploadSet = oEvent.getSource();
var oItemToUpload = oEvent.getParameter("item");
var oCustomerHeaderToken = new sap.ui.core.Item({
key: "x-csrf-token",
text: this.getModel().getSecurityToken()
});
// Header Slug
var oCustomerHeaderSlug = new sap.ui.core.Item({
key: "slug",
text: oItemToUpload.getFileName()
});
oUploadSet.removeAllHeaderFields();
oUploadSet.addHeaderField(oCustomerHeaderToken);
oUploadSet.addHeaderField(oCustomerHeaderSlug);
},
onItemRemoved: function (oEvent) {
this.getModel().remove(oEvent.getParameters().item.getBindingContext().sPath, {
success: this._refreshView.bind(this),
error: jQuery.proxy(this.errorFnDelete, this)
});
},
onUploadSetComplete: function (oEvent) {
var myBundle = this.getView().getModel("i18n").getResourceBundle();
sap.m.MessageToast.show(myBundle.getText("uploadSuccessful"));
this._refreshView();
},
Can you please help me find where this error come from? I have used UploadCollection before and it worked as a charm...
Thank you all
Request clarification before answering.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 5 | |
| 4 | |
| 4 | |
| 3 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.