Skip to Content
0
Aug 12, 2021 at 07:46 AM

How to add parameters to UploadSet?

802 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.

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,

Mio

Attachments

formdata.png (42.2 kB)