|
|
|
|
|
- Security error in a secure FTPS connection (syntax 2)
- Required permissions
- Required configuration
FTPConnect (Function) In french: FTPConnecte Connects the current computer to an FTP server (File Transfer Protocol). New in SaaSA new syntax for manipulating variables of type ftpConnection is available from WINDEV Suite SaaS 2025 - Update 2. New in SaaS
MaConnexionFTP is ftpConnection
MaConnexionFTP.Server = "192.54.12.8"
FTPConnect(MaConnexionFTP)
ResConnecte = FTPConnect("192.54.12.8")
Syntax New in SaaS
Connecting to an FTP server (parameters specified in syntax) Hide the details
<Result> = FTPConnect(<Server> [, <Username> [, <Password> [, <Port number> [, <Type of connection> [, <Timeout> [, <Private key> [, <Key password>]]]]]]])
<Result>: Integer - Connection ID,
- 0 during the first connection.
- -1 if an error occurred. The details of the error are returned by ErrorInfo with the errCode or errMessage constant.
If an authentication error occurs, ErrorInfo with the errCode constant returns the ftpErrorAuthentication constant.
<Server>: Character string Name or IP address of the FTP server (for example, "ftp.cdrom.com" or "192.54.12.8"). <Username>: Optional character string - Name of the user that tries to log in using login credentials. This parameter is set by FTP site administrator.
- Empty string ("") for an anonymous connection.
<Password>: Optional string or Secret string Password used to authenticate the user on the FTP server. This parameter is set by FTP site administrator.This password corresponds to: - the specified <Password> if this parameter is not an empty string (""),
- the email address of the user if <Username> is not specified or is an empty string (""),
- an empty string ("") if this parameter is not specified and <Username> is not an empty string ("").
Note: If the password contains special characters, it may be necessary to convert it to UTF-8 using StringToUTF8.
New in version 2025Secret strings: If you use the secret string vault, the type of secret string used for this parameter must be "ANSI or Unicode string". To learn more about secret strings and how to use the vault, see Secret string vault. New in version 2025 <Port number>: Optional integer Port number on which the server is to be run. This parameter is set by FTP site administrator.By default: - for an insecure connection, this port is port 21.
    for a secure connection in FTPS mode, this port is port 990.     for a secure connection in FTPES mode, this port is port 21.     for a secure connection in SFTP mode, this port is port 22.
<Type of connection>: Optional Integer constant Type of connection:
| | ftpActiveMode (or False for compatibility) | Active connection to the FTP server. In this mode, the client initiates the data connection. This type of connection may be refused by some protected FTP servers. | ftpExtendedPassiveMode | Extended passive connection to the FTP server (EPSV command). In this mode, the server initiates the data connection. This type of connection allows you to bypass some firewalls. If the server does not support the extended passive mode (the FEAT command is sent to the server to get its capabilities), the connection is downgraded to simple passive mode. Limitations: - This mode is not supported when using the Windows "wininet" module (see FTPConfigure). In this case, ftpPassiveMode is used.
  Constant not available. This constant is identical to the ftpPassiveMode.
| ftpPassiveMode (or True for compatibility) (Default value) | Passive connection to the FTP server (PASV command). In this mode, the server initiates the data connection. This type of connection allows you to bypass some firewalls. Note: If the connection to the server is established using IPV6, then the connection will be made in extended passive mode (passive mode does not support IPv6). | ftpPassiveModeIgnoreIP | Passive connection to the FTP server (PASV command). When transferring files in passive mode, the server sets the port and IP address for data transfer. With this parameter, only the port is taken into account. The IP address is ignored. This type of connection allows the use of FTP servers that return non-routable IP addresses but are reachable via the connection IP address Limitations: - This mode is not supported when using the Windows "wininet" module (see FTPConfigure). In this case, ftpPassiveMode is used.
  Constant not available.
|
<Timeout>: Optional integer or optional Duration Number of seconds after which the request for connecting to the FTP server is canceled (20 by default). This timeout applies to all FTP operations performed on this connection. If no response is received from the server within the specified time, FTPConnect returns -1. Note: This parameter can be: - an integer corresponding to the number of seconds,
- a Duration variable,
- the duration in a readable format (e.g., '1s').
<Private key>: Optional character string <Key password>: Optional ANSI string or Secret string
Related Examples:
|
Unit examples (WINDEV): The FTP functions
[ + ] Using the main FTP functions of WINDEV: - Connect to a FTP server - List the files and directories found on the FTP server - Retrieve the files found on the FTP server - Disconnect from a FTP server
|
|
Complete examples (WINDEV): WD FTP File Transfer
[ + ] WD FTP file transfer This example is a full FTP client allowing you to store several FTP servers. Then, you have the ability to perform multi-file transfers from the local computer to the server or from the FTP server to the local computer. To do so, we are using the standard functions of WLanguage (FTPConnect, etc...)
|
Business / UI classification: Business Logic
This page is also available for…
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|