---
title: "FTP update"
canonical: "https://docs.cuesystem.com/space/CVCHELP/512327689/FTP%20update"
format: markdown
---
> Macro (toc)

---

# GetFTPUpdateCredentials

This function returns credential values configured by AdminWeb in a unit on the FTP page. The command returns True on success or False if an error occurs.

#### Syntax

```visualbasic
Function GetFTPUpdateCredentials(ByRef serveraddress As Text, ByRef username As Text, ByRef password As Text, ByRef appbasefolder As Text, ByRef flags As Long) As Boolean
```

#### Parameters

serveraddress

The FTP update server address.

username

User name for login to FTP update server.

password

Password for login to FTP update server.

appbasefolder

Folder path with applications and firmware in FTP update server.

flags

Option FTP flags for communication with FTP update server

#### Return value

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> This function returns True on success or False if an error occurs. The function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the error number.

# DownloadFileFromFTP

This function downloads file from FTP or FTPS server and saves file content to the unit to the specified file. Only one download from the FTP server can take place at one time otherwise the function returns False and the last error is set to value 147. The command returns True on success or False if an error occurs.

Note: [FTP](https://en.wikipedia.org/wiki/File_Transfer_Protocol), [FTPS](https://en.wikipedia.org/wiki/FTPS)

#### Syntax

```visualbasic
Function DownloadFileFromFTP(serveraddress As Text, username As Text, password As Text, remote_filename As Text, local_filename As Text, Optional option_flags As Long := 0, Optional connect_timeout As Time := :10, Optional download_timeout As Time := _TIME_INFINITE) As Boolean
```

serveraddress

The FTP/FTPS server address.

username

Username for login to FTP/FTPS server.

password

Password for login to FTP/FTPS server.

remote_filename

source filename with a path on FTP/FTPS server.

local_filename

destination filename with a path on the unit.

option_flags

0 – Autodetection. The system selects the safest mode automatically from those supported by the FTP / FTPS server. If any FTPS mode is used then information from the SSL certificate is not verified.

_FTP_ALLOW_FTP_PLAINTEXT – only FTP plain text mode is allowed.

_FTP_ALLOW_FTPS_IMPLICIT – only implicit FTPS mode is allowed.

_FTP_ALLOW_FTPS_EXPLICIT – only explicit FTPS mode is allowed.

 If none mode of the above is specified all of them are allowed.

 _FTP_VERIFY_SSLCERTIFICATE - Enables verifying information (root CA, domain) from FTPS’s SSL certificate.

_FTP_MODE_PASSIVE - Force passive mode

_FTP_MODE_ACTIVE - Force active mode

Unless active or passive mode is specified both are enabled. Passive mode is tried first.

**Multiple flags** can be specified. Operator **BitOr **must be among them.

**Example **- the highest security – only encrypted communication is allowed and an SSL certificate is verified.

_FTP_ALLOW_FTPS_IMPLICIT **BitOr **_FTP_ALLOW_FTPS_EXPLICIT **BitOr **_FTP_VERIFY_SSLCERTIFICATE

**Example **- in the highest security – only encrypted communication is allowed, an SSL certificate is verified and passive mode is forced.

_FTP_ALLOW_FTPS_IMPLICIT **BitOr **_FTP_ALLOW_FTPS_EXPLICIT **BitOr **_FTP_VERIFY_SSLCERTIFICATE **BitOr **_FTP_MODE_PASSIVE

connect_timeout

timeout for connecting to FTP/FTPS update server.

download_timeout

timeout for downloading files from FTP/FTPS server.

#### Return value

<u>[Boolean](/wiki/spaces/CVCHELP/pages/495058958/Data+types#Boolean)</u> This function returns True on success or False if an error occurs.

A function <u>[GetLastError](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#GetLastError)</u> returns the err or number. The errors that can happen: [147](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#147), [800](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#800), [801](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#801), [802](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#802), [803](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#803), [804](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#804), [805](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#805), [806](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#806), [807](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#807), [808](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#808), [809](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#809), [810](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#810), [811](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#811), [812](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#812), [813](/wiki/spaces/CVCHELP/pages/510525445/Command+errors#813).