Skip to main content

Upload

Upload is a field that allows users on the form to upload files such as documents or images. It can be part of a template, or you can add it from the generics tab.

Upload field

How to set up upload API

First let's set an upload API. On the left panel go to API and create a new API connector. In our example let's call it "Upload API" and let's create a call and name it "Upload". The call method will be POST in our case, and we enter the API upload URL. Since we are using the POST method we also have to provide a response for initialization, because otherwise we can't make a test call. Response for your API can be found from your API response when you upload a file or in case you are using Better Store, you can use the following JSON as an example response:

{
"mimeType": "application/pdf",
"href": "https://store.better.care/rest/5d87731d-1782-4d6e-bcf4-820525503cbc",
"fileName": "summary.pdf",
"size": 39149,
"resourceId": "5d89951d-1782-4h6e-bcf4-821525503cbc"
}

The body type depends on the API you are using, in our case this is FORM_DATA. We will also need the following form data parameters resource, mediaType and alternateText.

After adding this start you can start a test call and save the API connector.

Now we need to add our form data to the parameters in our API. You can select all the values from the dropdown when you click Multimedia. We will bind resource to file, mediaType to fileType, and alternateText to fileName.

The only thing left is to bind the upload API to the Upload field. We do this by selecting the field and going to "Content" on the property panel. Here find "Upload" and select your upload API call from the dropdown. Bind the fields uri to href, mediatype to mimeType and alternatetext to fileName and you are done.

For more details please see the video below.