Creating Upload Content Component
This feature is used when the data is to be uploaded on Amazon S3 server by using "S3 Content Management Service" component of Contineo.
Steps
Create a component "S3 Content Management Service" from the Settings menu by specifying valid credentials.
Create a component Upload Content from the Actions menu and specify the property Content Management Service (= S3 service created in step 1 above).
Create JavaScript (from the Actions menu) and write the following code in the Properties so that the data (input parameters) required for the Upload Content action created in Step 2 is created.
Prerequisite to Upload from S3:
Configure S3 settings in Contineo as mentioned:
Click on Application, then click More. Select Routing. Open the Library Overrides tab.
Drag S3 Content Management Service. Click on the dragged component to open the Properties panel.
Add S3 details in **Properties > Connection Properties.
Create an Action with the type Upload Content:
In Properties > Input > Content Management Services dropdown list, select S3 Content Management Service. In this example,
uploadcsvtos3indicusis the name of the action created in step 1.varbasePath = utils.getRootPath() +"content/temp/attachments/";// This is an intermediate path from where your file is uploaded to the Amazon S3 server.var fileName = "DataFile9.csv";varfinalPath = basePath + fileName;varfinalPathForBrowserFile = finalPath.replace("/opt/tomcat/webapps/ROOT/","https://trial.contineonx.com/");context.log("finalPathForBrowserFile : "+ finalPathForBrowserFile);varuploadAPI = context.getApi("uploadcsvtos3indicus");uploadAPI.folderPath ="download";uploadAPI.fileInput = finalPath;context.log("finalPath : "+ uploadAPI.fileInput);varresult = uploadAPI.execute();// This uploads to S3context.log("S3 URL : "+ result);Create a button in your screen (widget), drag the action created in step 3 above into this UI, and select this action from the property "event handling" → "Server Action" of this button.
Click SAVE.