ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
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
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
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 website, 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 website 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.
    • manipulate files on an FTP server: create or delete files, etc.
    • 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. Close 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: 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 beginning with a slash is considered an absolute path: this is the path relative to the FTP server root (server-specific parameter).
    ex: /pub/user/FIONA
  • 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
AndroidAndroid Widget Different modes for secure connection are available:
  • FTPIS: SSL-secured FTP with implicit encryption.
  • FTPES: SSL-secured FTP with explicit encryption.
  • SFTP: FTP secured by an SSH tunnel.
To use one of these connection modes, all you have to do is use FTPConnect and specify the requested mode.
AndroidAndroid Widget

1. SFTP protocol

SFTP is the acronym for "Secure File Transfer Protocol". This protocol is based on a SSH channel (secure SSH connection).
Symmetric encryption algorithms supported: 3DES, Blowfish, AES and APRCFOUR.
This protocol is used by the Unix and Linux servers.
AndroidAndroid Widget

2. FTPS protocol

FTPS is the acronym for "File Transfer Protocol Secure". The communication is secured by the SSL protocol.
Symmetric encryption algorithms supported: 3DES, Blowfish, AES and APRCFOUR.
This protocol is used by the IIS Web servers.
Attention: The certificate certifying the certification body must be registered in the local certificate register.
Example:
  • The "XX" organization generates a certificate for the "PosteDoc" server: "xx-PosteDoc".
  • 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: 09/21/2024

Send a report | Local help