on 08-12-2021 8:46 AM
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
mioyasutake
You can add parameters to an UploadSet using the setParameters() method.
// create a new UploadSet object
let uploadSet = new UploadSet();
// define the parameters
let params = {
maxFileSize: "2MB",
allowedMimeTypes: ["image/jpeg", "image/png"],
maxNumberOfFiles: 10
};
// add the parameters to the UploadSet
uploadSet.setParameters(params);
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi yoganandamuthaiah,
Thanks for your reply.
I couldn't find setParameters() in the document, but is this available?
User | Count |
---|---|
95 | |
11 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.