High level function to download a file from the SFTP server.
This method is self-contained and opens a connection, receives a file and closes the connection. You don't have to call FtpConnect()
.
o.FtpGetFile(lcFTPServer, lcFtpSource, lcLocalTarget, lnBinary, lcUsername, lcPassword)
Return Value
0 for success, -1 for failure.
Parameters
lcFTPServer
IP Address or domain name of the server
lcFtpSourceFile
The Ftp file on the server to download. Specify a filename in the current path or relative paths.
- sailbig.jpg (current folder)
- subfolder/sailbig.jpg (subfolder below current folder)
- /subfolder/sailbig.jpg (subfolder below root folder)
lcLocalTarget
The local source file to download to. Either a physical or relative path.
lnBinary
ignored - pass in 0
lcUsername
Username for the accessing the server
lcPassword
Password for accessing the server
Example
loFtp = CREATEOBJECT("wwSftp")
loFtp.nFtpPort = 23
lcHost = "127.0.0.1"
lnPort = 23
lcUsername = "tester"
lcPassword = "password"
lnResult = loFtp.FtpGetFile(lcHost,"sailbig.jpg",".\tests\sailbig.jpg",1,lcUsername,lcPassword)
IF (lnResult != 0)
? loFtp.cErrorMsg
ENDIF
See also:
Class wwSFTP© West Wind Technologies, 2023 • Updated: 12/09/20
Comment or report problem with topic