> For the complete documentation index, see [llms.txt](https://community-test.logicnets.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://community-test.logicnets.com/release-9/platform-documentation/form-node-parts/file-download.md).

# File Download

## Description

The download part is located in form nodes and it allows application end users to download specified files to their file system from a LogicNets-based application. This part is often used in conjunction with the [file upload](/release-9/platform-documentation/form-node-parts/file-upload.md) part.

## Use

This part is located in the general form nodes for general applications and in form-part nodes for applications built using the Assessment Framework. It allows the application developer to provide a list of files in a collection, directory path, or data table for application users to download. Users can download the selected file or files to a local system or open the file in a new browser if the browser supports that file type.

LogicNets accepts all file types for download; however, the files will only open in the browser if the browser allows that file type.

## Tips & Tricks

Often an application will have BOTH the file upload and file download parts included, so a user can upload file(s) and the same (or different) user can see what has been uploaded, and choose to download if required. In this case, it is important to match the parameters in both parts.

* When using Source = Directory, match *Storage Location* and *Sub Folder.*
* When checking *Unique File Name* in the file upload, and downloading by file, select the correct data object name containing the new filename/path for the download source. Run your project in TEST and click on the *data* tab to search for/find the data object name.

## Editor Fields

When adding a file download option to an application, the application developer uses the following fields.

| Field Name                   | Description/Use                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | Type/Options          | Optional/Mandatory |
| ---------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- | ------------------ |
| <p>HTML enabled<br>(v8+)</p> | When this is enabled you can put HTML formatting in the Question caption, which means the system will display HTML tags in the text in the caption editor as they would appear in a browser. The editor browser provides limited HTML editing options for text formatting. You can toggle the HTML-enabled button on and off to alternate between seeing and editing tags and displaying them as they will appear.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         | Yes \| No             | Optional           |
| Question                     | This field should contain any text you want to display to the user.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        | Text                  | Optional           |
| Options                      | <p>These are the download options.<br>- <strong>Collection</strong>: With this option selected, you can specify the name of a collection that contains the list of files for download. Each item in the collection should have the following fields:<br>- filepath: This is the physical location of the file.<br>- caption: This is the caption that the system should display on the list. But also the caption will be the name of the downloaded file.<br>- filetype: This is the type of the file.<br>- time\_stamp \[optional]: This is the time stamp (last modified date) of the file.<br>- content \[optional]: It is possible to directly set the content of the file in this field<br>- encoding \[optional]: If the content of the file is encoded as base64, you can set the encoding to 'base64'.<br>Example collection:<br>- my\_collection.filepath = “C:\new\_file4.html”<br>- my\_collection.caption = “myfile”<br>- my\_collection.filetype = “txt”<br><strong>Note:</strong> If you point the download part to a file location containing too many files, the application may stop responding and will display a blank page. If that happens, reduce the amount of files located in the folder and try again. There is not an exact number of files that can be located in the file folder, as it can vary based on the capacity of each device.<br>- <strong>Directory:</strong> You can specify a path to a storage location on the server from which the files can be downloaded. If you click 'with subfolders' option, the system also lists the files in the subfolders.<br>- <strong>File:</strong> You can specify a filename that is made available to download. The downloaded filename can be different to the source file (e.g. add $(now) to the filename for it to be timestamped at the time of download, filename = download\_YYYYMMDD.HHMMSS.abc)<br>- <strong>Data Object:</strong> You can specify a data object that contains text or base64-encoded data to be downloaded. Enter the data object name in the source (data object) field.<br>- <strong>Datasource:</strong> You can specify the name of the data source (database and table) that contains the downloadable content. If you leave the database field empty the system assumes the table is within the package itself.<br>The table should have the following columns:<br>- caption: This is the caption the system will display on the list.<br>- content: This is the content of the file.<br>- filetype: This is the type of the file.<br>- encoding: base64 or empty.<br>You can create a table in the workspace in the resources\data folder or in an external database using SQL. An example SQL statement is CREATE TABLE \[NAME OF THE TABLE] (id Integer PRIMARY KEY AUTOINCREMENT UNIQUE NOT NULL, caption Text, content BLOB, filetype Text, encoding TEXT);. If you create a table in an external database, you must import the table definition into the workspace using the <em>Import definition from existing table</em> function in the resources\data folder of your project.</p> | Dropdown Menu         | Mandatory          |
| Directory                    | This is the storage location of the files for download by the download control.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                            | Text                  | Mandatory          |
| Sub folder                   | <p>This option becomes available when the storage location is set to '(local) \appdata' or '(local) \temp'. It allows you to specify the subfolder within the given directory to which the file(s) must be uploaded.<br>If the sub folder was specified in the File Upload part, then match the parameter here to be able to see uploaded files.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | Text                  | Optional           |
| (whitelisted) Path           | This option becomes available when the storage location is set to 'external directory'. It allows you to specify the path to the external directory. NOTE: External directories must be whitelisted in the *settings.cfg* file before the file can be downloaded.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          | Text                  | Mandatory          |
| Storage location             | <p>This is the storage location of the file(s):<br>- <strong>(local) \appdata</strong>: This is the \appdata folder in the company-dat folder of your LogicNets installation.<br>- <strong>(local) \temp</strong>: This is the \temp folder in your company-dat folder of your LogicNets installation. Note: The \temp folder will be cleared at set intervals so this location should be considered temporary storage.<br>- <strong>External directory</strong>: This is a custom location outside the standard \appdata and \temp folders.<br>NOTE: External directories must be whitelisted to allow files to be downloaded (or uploaded). See the <a href="https://support.logicnets.com/kc/logicnets.lns?_=KC&#x26;topic_id=459">Whitelisting Directories</a> article for more information.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       | Dropdown Menu         | Mandatory          |
| File type filter             | This field allows you to specify file type filters separated by a colon; for example, “.txt, .css, .html”. In this case, the system will only display files of type txt, css, or html. If the application developer does not set a filter type the system displays all available files.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | Text (case sensitive) | Optional           |
| Action                       | <p>This parameter specifies the possible actions for the user:<br>- <strong>Download:</strong> The item can be downloaded.<br>- <strong>Open:</strong> The item can only be opened in a new browser tab.<br>- <strong>Download and Open:</strong> The item can both be downloaded or opened in a new browser tab.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      | Dropdown Menu         | Mandatory          |
| Show stamp                   | If you check this checkbox the system shows an additional column for the time stamps of the files in the downloaded result.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | Checkbox              | Optional           |
| Show delete button           | If you check this checkbox the system will display a file delete button in the actions list. This allows users to remove a file from the list.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | Checkbox              | Optional           |
| Submit after delete          | If you click this checkbox the system will step the logicnet forward when the user clicks the delete button. This would allow you to display the outcome of the delete action, for example.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                | Checkbox              | Optional           |
| Deleted file (data object)   | <p>This option is only available if 'show delete button' is activated. When a user deletes a file, the system saves the following information on the provided location:<br>- filepath: This is the physical location of the file.<br>- filename: This is the caption that the system displayed on the list.<br>- filetype: This is the file type.<br>- delete\_at: This is the time stamp of the deletion.</p>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | Text                  | Optional           |
| Custom headers               | If you check this box the system displays your custom text instead of the predefined table headers. You enter the custom text in the following fields.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     | Checkbox              | Optional           |
| Custom header: Caption       | This option is only available if 'Custom headers' is activated. This field holds the text the system will display as the header instead of the default value 'Caption'.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    | Text                  | Optional           |
| Custom header: Time stamp    | This option is only available if 'Custom headers' is activated. This field holds the text the system will display instead of the default value 'Time stamp'.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               | Text                  | Optional           |
| Custom header: Actions       | This option is only available if 'Custom headers' is activated. This field holds the text the system will display instead of the default value 'Actions'.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  | Text                  | Optional           |
| Directly start download      | If you check this option the system downloads the item specified in the ItemId field. The ItemId points to the item in the collection (index) or the Id of the record in the database table. The system will not display the download control.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             | Checkbox              | Optional           |

## Styling

The file upload and download parts contain the standard form part template in the Assessment Framework, and in that use case are presented on screen in the same style as regular form parts for radiolists and checklists. Additionally, its is possible to use the part CSS class in the style tab to assign additional CSS declarations.

In LogicNets versions up to and including v7.3, to override the default styling of the table with all the files you must override the *file\_download\_table* class in your custom CSS file. For example, *.file\_download\_table { font-size:16px; }*

### Hiding an Empty Download Table

The download part will display on screen regardless of the number of files it presents (with no files in the specified location/directories, the titles will still appear. You can hide the table with the following CSS (which hides the table unless there is a second row - the first file listed)

```
file_download_table {display:none}
file_download_table:has(tr:nth-child(2)) {display:inline;}
```

Note there is a different solution for Firefox browsers outlined here – you should add this if you anticipate users browsing with Firefox.

<https://developer.mozilla.org/en-US/docs/Web/CSS/:has>

## Example

Please download and import the following [example project](/release-9/example-gallery/example-projects-for-parts/file-uploaddownload-example-project.md) to your workspace.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://community-test.logicnets.com/release-9/platform-documentation/form-node-parts/file-download.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
