PC SOFT

ONLINE HELP
FOR WINDEV, WEBDEV AND WINDEV MOBILE

Home | Sign in | English US
  • Internet browser
  • Security error in a secure connection
  • Limit
  • Required permissions
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadApple WatchUniversal Windows 10 AppWindows Mobile
Others
Stored procedures
Connects the current computer to an FTP server (File Transfer Protocol).
Versions 18 and later
WINDEVWEBDEV - Server codeWindows The available secure connection modes are as follows:
  • FTPS: FTP secured according to the SSL protocol with implicit encryption.
  • FTPES: FTP secured according to the SSL protocol with explicit encryption.
  • SFTP: FTP secured by a SSH channel.
New in version 18
WINDEVWEBDEV - Server codeWindows The available secure connection modes are as follows:
  • FTPS: FTP secured according to the SSL protocol with implicit encryption.
  • FTPES: FTP secured according to the SSL protocol with explicit encryption.
  • SFTP: FTP secured by a SSH channel.
WINDEVWEBDEV - Server codeWindows The available secure connection modes are as follows:
  • FTPS: FTP secured according to the SSL protocol with implicit encryption.
  • FTPES: FTP secured according to the SSL protocol with explicit encryption.
  • SFTP: FTP secured by a SSH channel.
WINDEVWEBDEV - Server codeWindowsAndroidAndroid Widget The available secure connection modes are as follows:
  • FTPS: FTP secured according to the SSL protocol with implicit encryption.
  • FTPES: FTP secured according to the SSL protocol with explicit encryption.
  • SFTP: FTP secured by a SSH channel.
Versions 15 and later
Android This function is now available for the Android applications.
New in version 15
Android This function is now available for the Android applications.
Android This function is now available for the Android applications.
Versions 18 and later
Android Widget This function is now available in Android Widget mode.
WINDEVLinux This function is now available for the WINDEV applications in Linux.
WEBDEV - Server codeLinux This function is now available for the WEBDEV sites in Linux.
iPhone/iPad This function is now available for the iPhone/iPad applications.
New in version 18
Android Widget This function is now available in Android Widget mode.
WINDEVLinux This function is now available for the WINDEV applications in Linux.
WEBDEV - Server codeLinux This function is now available for the WEBDEV sites in Linux.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Android Widget This function is now available in Android Widget mode.
WINDEVLinux This function is now available for the WINDEV applications in Linux.
WEBDEV - Server codeLinux This function is now available for the WEBDEV sites in Linux.
iPhone/iPad This function is now available for the iPhone/iPad applications.
Versions 22 and later
AndroidAndroid Widget The secure connection mode (FTPS, FTPES and SFTP) are now available for the Android applications and for the Android Widgets.
New in version 22
AndroidAndroid Widget The secure connection mode (FTPS, FTPES and SFTP) are now available for the Android applications and for the Android Widgets.
AndroidAndroid Widget The secure connection mode (FTPS, FTPES and SFTP) are now available for the Android applications and for the Android Widgets.
// Connect the current computer to the FTP server
ResConnect = FTPConnect("192.54.12.8")
Syntax
<Result> = FTPConnect(<Server> [, <User Name> [, <Password> [, <Port Number> [, <Type of Connection> [, <Connection Time-out> [, <Private Key> [, <Key Password>]]]]]]])
<Result>: Integer
  • Connection identifier,
  • 0 during the first connection.
  • -1 if an error occurred. The detailed error report is returned by ErrorInfo associated with the errCode or errMessage constant.
    If an identification error occurs, ErrorInfo associated with the errCode constant returns the ftpErrorAuthentification constant.
PHP This parameter is a Variant parameter that corresponds to the connection identifier or -1 if an error occurs.
<Server>: Character string (with quotes)
Name of FTP server ("ftp.cdrom.com" for example) or IP address of FTP server ("192.54.12.8" for example).
Versions 18 and later
WINDEVWEBDEV - Server codeWindows This parameter is used to define the protocol used:
  • if the server name starts with "ftp://", the connection is established in non-secure mode.
  • if the server name starts with "ftps://", the connection is established in secure mode according to the FTPS protocol (FTP secured by SSL with implicit encryption).
  • if the server name starts with "ftpes://", the connection is established in secure mode according to the FTPES protocol (FTP secured by SSL with explicit encryption).
  • if the server name starts with "sftp://", the connection is established in secure mode via a SSH channel according to the SFTP protocol.
New in version 18
WINDEVWEBDEV - Server codeWindows This parameter is used to define the protocol used:
  • if the server name starts with "ftp://", the connection is established in non-secure mode.
  • if the server name starts with "ftps://", the connection is established in secure mode according to the FTPS protocol (FTP secured by SSL with implicit encryption).
  • if the server name starts with "ftpes://", the connection is established in secure mode according to the FTPES protocol (FTP secured by SSL with explicit encryption).
  • if the server name starts with "sftp://", the connection is established in secure mode via a SSH channel according to the SFTP protocol.
WINDEVWEBDEV - Server codeWindows This parameter is used to define the protocol used:
  • if the server name starts with "ftp://", the connection is established in non-secure mode.
  • if the server name starts with "ftps://", the connection is established in secure mode according to the FTPS protocol (FTP secured by SSL with implicit encryption).
  • if the server name starts with "ftpes://", the connection is established in secure mode according to the FTPES protocol (FTP secured by SSL with explicit encryption).
  • if the server name starts with "sftp://", the connection is established in secure mode via a SSH channel according to the SFTP protocol.
Versions 18 and later
WINDEVWEBDEV - Server codeWindowsAndroidAndroid Widget This parameter is used to define the protocol used:
  • if the server name starts with "ftp://", the connection is established in non-secure mode.
  • if the server name starts with "ftps://", the connection is established in secure mode according to the FTPS protocol (FTP secured by SSL with implicit encryption).
  • if the server name starts with "ftpes://", the connection is established in secure mode according to the FTPES protocol (FTP secured by SSL with explicit encryption).
  • if the server name starts with "sftp://", the connection is established in secure mode via a SSH channel according to the SFTP protocol.
New in version 18
WINDEVWEBDEV - Server codeWindowsAndroidAndroid Widget This parameter is used to define the protocol used:
  • if the server name starts with "ftp://", the connection is established in non-secure mode.
  • if the server name starts with "ftps://", the connection is established in secure mode according to the FTPS protocol (FTP secured by SSL with implicit encryption).
  • if the server name starts with "ftpes://", the connection is established in secure mode according to the FTPES protocol (FTP secured by SSL with explicit encryption).
  • if the server name starts with "sftp://", the connection is established in secure mode via a SSH channel according to the SFTP protocol.
WINDEVWEBDEV - Server codeWindowsAndroidAndroid Widget This parameter is used to define the protocol used:
  • if the server name starts with "ftp://", the connection is established in non-secure mode.
  • if the server name starts with "ftps://", the connection is established in secure mode according to the FTPS protocol (FTP secured by SSL with implicit encryption).
  • if the server name starts with "ftpes://", the connection is established in secure mode according to the FTPES protocol (FTP secured by SSL with explicit encryption).
  • if the server name starts with "sftp://", the connection is established in secure mode via a SSH channel according to the SFTP protocol.
<User Name>: Optional character string (with quotes)
  • Name of user attempting to perform a named connection (user authentication on FTP server). This parameter is given by the administrator of FTP server.
  • Empty string ("") to perform an anonymous connection.
<Password>: Optional character string (with quotes)
User password: used to identify the user on the FTP server. This parameter is given by the administrator of FTP server.
This password corresponds to:
  • the specified <Password> if this parameter is not an empty string (""),
  • the email address of the user if <User Name> is not specified or it is equal to an empty string (""),
  • an empty string ("") if this parameter is not specified and if <User Name> does not correspond to an empty string(").
<Port Number>: Optional integer
Number of the port on which the server will be run. This parameter is given by the administrator of FTP server.
By default:
  • for a non-secure connection, this port is port 21.
Versions 18 and later
  • WINDEVWEBDEV - Server codeWindows for a secure connection in FTPS mode, this port is port 990.
  • WINDEVWEBDEV - Server codeWindows for a secure connection in FTPES mode, this port is port 21.
  • WINDEVWEBDEV - Server codeWindows for a secure connection in SFTP mode, this port is port 22.
New in version 18
  • WINDEVWEBDEV - Server codeWindows for a secure connection in FTPS mode, this port is port 990.
  • WINDEVWEBDEV - Server codeWindows for a secure connection in FTPES mode, this port is port 21.
  • WINDEVWEBDEV - Server codeWindows for a secure connection in SFTP mode, this port is port 22.
  • WINDEVWEBDEV - Server codeWindows for a secure connection in FTPS mode, this port is port 990.
  • WINDEVWEBDEV - Server codeWindows for a secure connection in FTPES mode, this port is port 21.
  • WINDEVWEBDEV - Server codeWindows for a secure connection in SFTP mode, this port is port 22.
  • WINDEVWEBDEV - Server codeWindowsAndroidAndroid Widget for a secure connection in FTPS mode, this port is port 990.
  • WINDEVWEBDEV - Server codeWindowsAndroidAndroid Widget for a secure connection in FTPES mode, this port is port 21.
  • WINDEVWEBDEV - Server codeWindowsAndroidAndroid Widget for a secure connection in SFTP mode, this port is port 22.
<Type of Connection>: Optional Integer constant
Type of connection to establish:
  • True (by default) for a passive connection to the FTP server. When transferring files, the server takes the initiative for the transfer. This type of connection is used to step over some "firewalls".
  • False for an active connection to the FTP server. During a file transfer, the client takes the initiative for the transfer. This type of connection may be refused by some protected FTP servers.
Type of connection to establish:
Versions 21 and later
ftpActiveMode
New in version 21
ftpActiveMode
ftpActiveMode (or False for compatibility)
Active connection to the FTP server.
During a file transfer, the client takes the initiative for the transfer. This type of connection may be refused by some protected FTP servers.
Versions 21 and later
ftpPassiveMode
New in version 21
ftpPassiveMode
ftpPassiveMode (or True for compatibility)
(Default value)
Passive connection to the FTP server (PASV mode).
When transferring files, the server takes the initiative for the transfer. This type of connection is used to step over some "firewalls".
Note: If the connection to the server is in IPV6, the connection will be performed in extended passive mode (because the passive mode does not support IPV6).
Versions 21 and later
ftpExtendedPassiveMode
New in version 21
ftpExtendedPassiveMode
ftpExtendedPassiveMode
Extended passive connection to the FTP server (EPSV mode).
When transferring files, the server takes the initiative for the transfer. This type of connection is used to step over some "firewalls".
If the server does not support the extended passive mode (the FEAT command is sent to the server to find out the capacity), the connection is crippled in simple passive mode.
Limitations:
  • This mode is not supported when using the "wininet" module of Windows (see FTPParameter): the connection is performed in ftpPassiveMode.
  • AndroidAndroid Widget Java Constant not available.
  • Windows MobilePHP This constant is identical to the ftpPassiveMode constant.
<Connection Time-out>: Optional integer or optional Duration
Number of seconds after which the request for connecting to the FTP server is canceled (20 by default). This time-out applies to all FTP operations performed on this connection. If no response is received from the server during the specified <Connection Time-out>, FTPConnect returns -1.
Note: This parameter can correspond to:
  • an integer corresponding to the number of seconds,
  • a Duration variable,
  • Versions 23 and later
    the direct indication of duration (1 s for example).
    New in version 23
    the direct indication of duration (1 s for example).
    the direct indication of duration (1 s for example).
PHP This parameter corresponds to an integer.
<Private Key>: Optional character string (with quotes)
Versions 18 and later
WINDEVWEBDEV - Server codeWindows Name and path of file corresponding to the private key used during a connection in SFTP mode. This file must have been generated in OpenSSH format.
If this parameter is not specified, the secure connection uses an authentication by <User Name>/<Password>.
New in version 18
WINDEVWEBDEV - Server codeWindows Name and path of file corresponding to the private key used during a connection in SFTP mode. This file must have been generated in OpenSSH format.
If this parameter is not specified, the secure connection uses an authentication by <User Name>/<Password>.
WINDEVWEBDEV - Server codeWindows Name and path of file corresponding to the private key used during a connection in SFTP mode. This file must have been generated in OpenSSH format.
If this parameter is not specified, the secure connection uses an authentication by <User Name>/<Password>.
WINDEVWEBDEV - Server codeWindowsAndroidAndroid Widget Name and path of file corresponding to the private key used during a connection in SFTP mode. This file must have been generated in OpenSSH format.
If this parameter is not specified, the secure connection uses an authentication by <User Name>/<Password>.
<Key Password>: Optional ANSI character string (with quotes)
Versions 18 and later
WINDEVWEBDEV - Server codeWindows Password of the file containing the private key used during a connection in SFTP mode. If this parameter is not specified, the secure connection uses an authentication by <User Name>/<Password>.
New in version 18
WINDEVWEBDEV - Server codeWindows Password of the file containing the private key used during a connection in SFTP mode. If this parameter is not specified, the secure connection uses an authentication by <User Name>/<Password>.
WINDEVWEBDEV - Server codeWindows Password of the file containing the private key used during a connection in SFTP mode. If this parameter is not specified, the secure connection uses an authentication by <User Name>/<Password>.
WINDEVWEBDEV - Server codeWindowsAndroidAndroid Widget Password of the file containing the private key used during a connection in SFTP mode. If this parameter is not specified, the secure connection uses an authentication by <User Name>/<Password>.
Remarks
WINDEVWEBDEV - Server codeReports and QueriesWindowsWindows MobileAjaxUser code (UMC)

Internet browser

FTPConnect requires Internet Explorer version 3 or later.
The modifications made to <Time-out> have no effect with some versions of Internet Explorer. It is a known problem of Microsoft components that is fixed in the more recent versions of Internet Explorer (version 5.1 and later).
Versions 18 and later
WINDEVWEBDEV - Server codeWindowsLinux

Security error in a secure connection

During a secure transaction, the function may fail due to security errors:
  • invalid certificate or certificate coming from an unknown company.
  • site name found in the certificate not corresponding to a server.
  • invalid or expired certificate date.
You have the ability to connect while ignoring these errors. To do so, use the FTP.IgnoreError variable:
Value of FTP.IgnoreError
(these values can be combined)
Description
ftpIgnoreInvalidCertificateThe certificate is ignored.
ftpIgnoreExpiredCertificateThe certificate date is ignored.
ftpIgnoreInvalidCertificateNameThe site name specified in the certificate is ignored.
ftpIgnoreRevocationThe certificate revocation is ignored.
// Example for error management

xnum is int
FTP.IgnoreError = ftpIgnoreExpiredCertificate + ftpIgnoreInvalidCertificate + ...
ftpIgnoreInvalidCertificateName + ftpIgnoreRevocation
xnum = FTPConnect("ftpes://My_Server_IP", "My_User", "My_Password", 21, True)
IF xnum =-1  THEN
      Info(ErrorInfo(errMessage))
ELSE
      Info("OK")
END
New in version 18
WINDEVWEBDEV - Server codeWindowsLinux

Security error in a secure connection

During a secure transaction, the function may fail due to security errors:
  • invalid certificate or certificate coming from an unknown company.
  • site name found in the certificate not corresponding to a server.
  • invalid or expired certificate date.
You have the ability to connect while ignoring these errors. To do so, use the FTP.IgnoreError variable:
Value of FTP.IgnoreError
(these values can be combined)
Description
ftpIgnoreInvalidCertificateThe certificate is ignored.
ftpIgnoreExpiredCertificateThe certificate date is ignored.
ftpIgnoreInvalidCertificateNameThe site name specified in the certificate is ignored.
ftpIgnoreRevocationThe certificate revocation is ignored.
// Example for error management

xnum is int
FTP.IgnoreError = ftpIgnoreExpiredCertificate + ftpIgnoreInvalidCertificate + ...
ftpIgnoreInvalidCertificateName + ftpIgnoreRevocation
xnum = FTPConnect("ftpes://My_Server_IP", "My_User", "My_Password", 21, True)
IF xnum =-1  THEN
      Info(ErrorInfo(errMessage))
ELSE
      Info("OK")
END
WINDEVWEBDEV - Server codeWindowsLinux

Security error in a secure connection

During a secure transaction, the function may fail due to security errors:
  • invalid certificate or certificate coming from an unknown company.
  • site name found in the certificate not corresponding to a server.
  • invalid or expired certificate date.
You have the ability to connect while ignoring these errors. To do so, use the FTP.IgnoreError variable:
Value of FTP.IgnoreError
(these values can be combined)
Description
ftpIgnoreInvalidCertificateThe certificate is ignored.
ftpIgnoreExpiredCertificateThe certificate date is ignored.
ftpIgnoreInvalidCertificateNameThe site name specified in the certificate is ignored.
ftpIgnoreRevocationThe certificate revocation is ignored.
// Example for error management

xnum is int
FTP.IgnoreError = ftpIgnoreExpiredCertificate + ftpIgnoreInvalidCertificate + ...
ftpIgnoreInvalidCertificateName + ftpIgnoreRevocation
xnum = FTPConnect("ftpes://My_Server_IP", "My_User", "My_Password", 21, True)
IF xnum =-1  THEN
      Info(ErrorInfo(errMessage))
ELSE
      Info("OK")
END
AndroidAndroid Widget

Limit

The use of secure protocols (sFTP, FTPS, ...) is available for the devices equipped with ARM processors. A fatal error occurs if this function is used with devices not equipped with ARM processors (x86, mips, ...).The use of secure protocols (sFTP, FTPS, ...) is available for the devices equipped with ARM processors or using the ARM emulation.
A fatal error occurs if FTPConnect is called:
  • on devices with non-ARM processors (x86, mips, ...) that do not use an ARM emulation,
  • on the Samsung Galaxy Tab 3 tablet.
AndroidAndroid Widget

Required permissions

The call to this function modifies the permissions required by the application.
Required permission : INTERNET
This permission allows the applications to open the network sockets.
Related Examples:
The FTP functions Unit examples (WEBDEV): The FTP functions
[ + ] This example presents the main FTP functions of WEBDEV and it allows you to:
- Connect to an FTP server
- List the files and directories found on the FTP server
- Retrieve the files found on the FTP server
- Disconnect from an FTP server
WD FTP File Transfer Complete examples (WINDEV): 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.)
Components
WINDEVWEBDEV - Server codeReports and Queries wd230com.dll
Windows Mobile wp230com.dll
Java wd230java.jar
Linux wd230com.so
Android wd230android.jar
Minimum required version
  • Version 9
This page is also available for…
Comments
Video FtpConnect
https://youtu.be/P3cQ9XJDGYk
amarildo
Oct. 26 2018