Gets a file from a remote server and saves it on the local machine.

Function Group Execution Windows Embedded Thin Client Mobile Access
FTPGet FTP Asynchronous Supported Supported Supported Not supported


  FTPGet( strRemoteFile, strLocalFile, numTransferType, numOverwrite )  
The full path and name of the desired file on the remote server, using the syntax “/file path/file name.extension. Some FTP servers are case sensitive, so you should always use correct capitalization.
The full path and name where you want to save the file on the local machine, using the syntax “C:file name.extension.
A numeric flag that specifies the file transfer type. This parameter is optional; if no value is given, then the transfer type is unknown (0) by default.
0 Unknown
2 Binary
10 Unknown, without caching
11 ASCII, without caching
12 Binary, without caching
Note: In most cases, you should use option 10. This automatically detects the format (ASCII or Binary) of the remote file and sets the transfer type accordingly, and it also forces the project to download the file from the actual FTP server rather than from an intervening proxy or cache server.
A numeric value that specifies whether the local file (specified by strLocalFile) may be overwritten if it already exists. This parameter is optional; the default value is 0.
0 Do not overwrite — return an error if the file already exists.
1 Overwrite.

Returned value

1 Failed to open FTP connection
0 Success
-1 Invalid number of parameters
-2 Unknown system error
-3 Invalid remote file
-4 Invalid local file
-5 Invalid transfer type


Before you can call this function, you must configure the FTP settings (i.e., server address and login) using the CnfFTP function.

Also, this function is executed asynchronously, so you must call the FTPStatus function to see if the transfer has been completed successfully.


Tag Name Expression
Tag FTPGet( “Reports40303.txt”, “C:Report.txt” ) // Retrieves the file 040303.txt in the Reports directory, from the FTP server that was previously specified by CnfFTP(), It then saves the file locally at C:Report.txt.