Tuto WINDEV 25
424 Part 7: Advanced programming Retrieving a file To get a file from an FTP server, all you have to do is call FTPGet . Let’s see a code sample that can be used: // When connecting to the server with FTPConnect, we have // retrieved the connection number in the gnConnectionID variable // Download the "/Document/File.DOC" file found // on the FTP server to the "D:\Temp" directory on // the current computer bResult is boolean = FTPGet(gnConnectionID, ... "/Document/File.DOC", "D:\Temp") Disconnecting from an FTP server To disconnect from an FTP server, use FTPDisconnect . ▶ Display the WLanguage events associated with the "Disconnection" Button control in "WIN_ FTP": 1. Select the "Disconnection" Button control. 2. Press F2 to display the associated WLanguage code: IF YesNo(No, "Do you want to close the connection to the FTP ser ver?") = Yes THEN // Disconnect from the FTP server FTPDisconnect(gnConnectionID) IF ErrorOccurred THEN // Error while closing the connection Error("Unable to close the FTP connection", ErrorInfo()) RETURN END // The connection is ended Info("The connection to the FTP server is ended") END Other FTP functions are available but we won’t go into details about them in this tutorial. They are mainly used to: • create, delete, modify directories on the FTP server, • create, delete, modify files on the FTP server, • retrieve information about a directory and/or a file, • ... See the online help for more details (keyword: "FTP, Functions").
Made with FlippingBook
RkJQdWJsaXNoZXIy NDQ0OA==