Discuss

File Downloads with Server Connect

On this page

You can create a file download action in Server Connect, which allows you to download files from your server. You can use static or dynamic file names for the download action, so it can easily be used in cases where you need to export data (csv/xml) and download the exported file, download zip archives or any other file. In this tutorial we will show you the basics of file download action.


Download File Server Action

First, open the Server Connect panel:

Screenshot_1|690x417

Create new server action:

Screenshot_2|690x416

We call it download. Right click Steps:

Screenshot_3|690x416

Open File Management and select File Download:

Screenshot_4|690x416

Select the path to your file. This can be dynamic or static, so if you have some dynamic action returning the path to your file, select it here:

Screenshot_5|690x416

In our case this is a static path, so we just browse to the file and select it:

Screenshot_6|690x416

Save your server action:

Screenshot_7|690x416

Server Connect Routing

You can directly link to your server action, browsing to the file in the dmxConnect/api/.. folder, but we suggest using routing instead. It's easier to add the link to the server action on the page later and does not directly expose the link to the server action.

Open the Routing panel:

Screenshot_8|690x416

Create a new Server Connect Route:

Screenshot_9|690x416

Select your download action and click the Select button:

Screenshot_10|690x416

It automatically sets the routing path to /api/server_action_name but you can change it to whatever you like. We are just fine with this path, so we leave it as it is:

Screenshot_11|690x416

We are done with this part.

Close the routing panel and open the App Connect Panel:

Screenshot_12|690x416

On our page you can see an anchor button, but this also works with a regular link. Select your link/anchor button and click the Route Picker icon for the link:

Screenshot_13|690x416

Select the route to the download server action and click the Select button:

Screenshot_14|690x416

Save your page and we are done. Here's the result:

donwload_files|690x394