ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Communication / FTP functions / WLanguage procedure
  • Characteristic of the procedure
  • Interruption of FTPListFile
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
WLanguage procedure called by FTPListFile
Procedure ("Callback") called by FTPListFile for each file found. This procedure can be a local, global or internal procedure.
Example
WINDEVWEBDEV - Server codeReports and QueriesJavaUser code (UMC)Ajax
// Connection to an FTP site
nConnection is int
nConnection = FTPConnect("ftp.cdrom.com")
 
nFile is int  // Number of files found in the directory
nJPG is int // Number of .JPG files
nJPG = 0
 
// List ".JPG" files in the current directory
nFile = FTPListFile(nConnection, "", FTPListFile_Callback, ftpFile, nJPG)
Info("There are" + nJPG + ".JPG files in" + nFile + "listed files")
 
 
// Procedure called by FTPListFile
// For each file found, the FTPListFile_Callback procedure
// allows counting the number of files with ".JPG" extension.
INTERNAL PROCÉDURE FTPListFile_Callback(Name, nSize, sAttribute, sDate, sTime, nParam)
IF Right(Name, 4) ~= ".JPG" THEN
nParam++
END
RETURN True
END
Syntax
<Result> = FTPListFile_Callback(<File> , <Size> , <Attribute> , <Date> , <Time> , <Procedure parameter>)
<Result>: Boolean
  • True to continue browsing the files,
  • False to stop browsing the files.
<File>: Character string
Name of file or directory used.
<Size>: Integer
Size of the found file in bytes. This parameter must be ignored for a directory.
<Attribute>: Character string
Attributes of the file or directory found. The format used is identical to the one of FTPAttribute.
<Date>: Character string
Modification date of the file (or directory) found. The format used is "YYYYMMDD".
<Time>: Character string
Modification time of the file (or directory) found. The format used is "HHMMSS".
<Procedure parameter>: Variant
value passed to the <Parameter> of FTPListFile. If <Parameter> is not specified, <Procedure parameter> is set to 0.
Remarks

Characteristic of the procedure

Caution: In this procedure:
  • no FTP function that uses the same connection as FTPListFile must be called.
  • you can retrieve the properties (name, size, attributes, dates and times) of the file listed by FTPName, FTPSize, FTPAttribute, FTPDate and FTPTime. However, this solution takes a lot of time: it requires an additional request to the FTP server. Therefore, it is easier to directly read the optional parameters passed to the procedure.

Interruption of FTPListFile

FTPListFile cannot be interrupted as long as there are files to browse through. To force the interruption of the browse, use the following line in the procedure:
RESULT False
In this case, FTPListFile returns the number of files browsed until the call to "RESULT False".
In any other case (to continue browsing), the procedure MUST return True.
An error is generated if the procedure returns no value (neither True nor False).
Business / UI classification: Neutral code
Component: wd290com.dll
Minimum version required
  • Version 9
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help