ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Communication / FTP functions
  • Overview
  • FTP
  • Use convention
  • Principle
  • Relative path/Absolute path
  • Secure FTP server: SFTP and FTPS protocols
  • 1. SFTP protocol
  • 2. FTPS protocol
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Handling files on an FTP server
Overview
FTP (File Transfer Protocol) is a protocol for transferring files from one site to another. This protocol allows you to exchange files via TCP/IP or the Internet.
On the Internet, thousands of file servers can be accessed via FTP. These servers propose shareware or freeware to the public.
WINDEV and WEBDEV include several WLanguage functions allowing you to manage files on an FTP server from your applications or sites.
FTP

Use convention

  • In theory, you cannot connect to an FTP site without an FTP account and a password. Only a user with an account and a password can connect to this site.
  • Practically, all the servers found on Internet have an Anonymous account. The password of this account is not implemented but an email address will be requested.
To download the files found on an FTP server, all you have to do is connect as "anonymous user".
To upload files to an FTP server (to send HTML pages to your Web site for example), a non-anonymous account and a password are required.
Principle
To handle the files found on an FTP server from a WINDEV application or from a WEBDEV site, you must follow these rules:
  1. Connecting to an FTP server (FTPConnect).
  2. Send and retrieve files (according to the connection mode).
    For a passive connection, the WINDEV application or the WEBDEV site must request the authorization from the FTP server before each file operation on the server. You can also:
    • get the characteristics of the files located on an FTP server: attributes, size, etc.
    • handle files on an FTP server: create, delete...
    • list the files of a directory found on the FTP server by running a procedure used to perform a process for each file found.
  3. Closing the connection to the server (FTPDisconnect).
Caution:
  • The TCP/IP communication protocol must be installed and an IP address must be defined.
  • An FTP server must be installed and configured on one of the computers used to perform the transfer.
  • Android Caution: The FTP functions cannot be used in the Android emulator.
Relative path/Absolute path
The notions of relative path and absolute path are very important in an FTP application.
  • A path starting with a slash is considered as being an absolute path: it is the path in relation to the root of the FTP server (parameter specific to the server).
    ex: /pub/user/FLO
  • A path not starting with a slash is considered as being a relative path, which means a path given in relation to the current directory. This current directory can be returned or modified by FTPCurrentDir.
When connecting to an FTP site, the initial directory (the "base directory" of the user) is not necessarily found at the root of the FTP server. Therefore, we recommend that you use relative paths.
Secure FTP server: SFTP and FTPS protocols
WINDEVWEBDEV - Server codeWindowsAndroidAndroid Widget Different modes for secure connection are available:
  • FTPIS: 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.
To use one of these connection modes, all you have to do is use FTPConnect and specify the requested mode.
WINDEVWEBDEV - Server codeWindowsAndroidAndroid Widget

1. SFTP protocol

SFTP is the acronym for "Secure File Transfer Protocol". This protocol is based on a SSH channel (secure SSH connection).
The following symmetric encryption algorithms are supported: 3DES, Blowfish, AES and APRCFOUR.
This protocol is used by the Unix and Linux servers.
WINDEVWEBDEV - Server codeWindowsAndroidAndroid Widget

2. FTPS protocol

FTPS is the acronym for "File Transfer Protocol Secure". The communication is secured by the SSL protocol.
The following symmetric encryption algorithms are supported: 3DES, Blowfish, AES and APRCFOUR.
This protocol is used by the IIS Web servers.
Caution: The certificate certifying the company for certificate certification must be saved in the registry of local certificates.
Example:
  • The "XX" company generates a certificate for the "DocPC" server: "xx-DocPC".
  • The "xx-DocPC" certificate is used for configuring the server.
  • On the contrary, the certificate certifying "XX" (let's call it the "XX certificate") must be saved on the client computer.
Most of the certifying companies are already saved in the operating system of client computer.
However, if a specific company creates a certificate and if the base certificate is not saved on the client computer, the error "The certificate cannot be checked" will occur.
Related Examples:
The FTP functions 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
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
WM FTP Client Cross-platform examples (WINDEV Mobile): WM FTP Client
[ + ] This example is an FTP Client for Android and iOS.
It explains how to interact with an FTP server via the FTP functions of WLanguage.
It is used to:
- Rename files
- Delete files
- Create folders
- Download files
- Send files to the server
WD FTP File Transfer 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...)
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 06/22/2023

Send a report | Local help