Tuto WINDEV 25

422 Part 7: Advanced programming gnConnectionID = FTPConnect(sFTPAddress, sUserName, ... sUserPWD) IF ErrorOccurred THEN // An error occurred during the connection Error("The connection to the FTP server: " + ... sFTPAddress + " failed", ErrorInfo()) RETURN END // The connection is established Info("The connection to the FTP server is established", ... "connection identifier: " + gnConnectionID) Remark: You also have the ability to specify the port number for connecting to the FTP server ("21" by default) as well as the connection mode ("True" for a "passive" connection, "False" for an "active" connection). See the online help for more details (keyword: "FTP, Functions"). Sending a file To send a file to an FTP server, all you have to do is use FTPSend . 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 // Transfer the "C:\MyDocuments\File.DOC" file to // the "Temp" directory found on the server. bResult is boolean = FTPSend(gnConnectionID, ... "C:\MyDocuments\File.DOC", "/Temp") Caution! Pay great attention to the case (uppercase/lowercase characters) for the name of directories on the server. Indeed, some FTP servers operate under UNIX and are "case sensitive", which means that the case is taken into account for the name of files and directories. For example, a directory named "MyDirectory" is found on the FTP server. If you try to access "mydirectory", an error such as "Path not found" will be returned by the FTP server because the case is incorrect.

RkJQdWJsaXNoZXIy NDQ0OA==