4

How to add parameters to UploadSet?

 1 year ago
source link: https://answers.sap.com/questions/13459114/how-to-add-parameters-to-uploadset.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
Aug 12, 2021 at 07:46 AM

How to add parameters to UploadSet?

512 Views Last edit Aug 12, 2021 at 07:48 AM 2 rev

Hi community,

I'm trying to upload files to Document Management Service.

To do so, I need to send some form data together with a file. The screenshot below is the actual form data sent.

1966461-formdata.png

With UploadCollection we would do this by the following code.

        onAttachmentsChange: function (oEvent) {
            var oUploadCollection = oEvent.getSource();
            oUploadCollection.addParameter(new UploadCollectionParameter({
                name: "cmisAction",
                value: "createDocument" // create file
            }));

            oUploadCollection.addParameter(new UploadCollectionParameter({
                name: "propertyId[0]",
                value: "cmis:objectTypeId"
            }));

            oUploadCollection.addParameter(new UploadCollectionParameter({
                name: "propertyValue[0]",
                value: "cmis:document"
            }));

            oUploadCollection.addParameter(new UploadCollectionParameter({
                name: "propertyId[1]",
                value: "cmis:name"
            }));

            oUploadCollection.addParameter(new UploadCollectionParameter({
                name: "propertyValue[1]",
                value: oEvent.getParameter("files")[0].name
            }));
        },

Now that UploadCollection is deprecated, I want to implement upload using UploadSet.

However, in UploadSet I cannot find a method equivalent to addParameter() in UploadCollection.

How can I add parameters to UploadSet? Or, should I fall back to UploadCollection for this case?

Best regards,


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK