wwSFTP::FtpSendFile

Single method call to send a file to the FTP server.

This method is self-contained and opens a connection, sends a file and closes the connection. You don't have to call FtpConnect().

o.FtpSendFile(lcFTPServer, lcSource, lcTarget, lcUsername, lcPassword)

Return Value

0 for success, -1 for failure

Parameters

lcFTPServer
The FTP Server to send to. This is a domain name (mysite.com) or IP address (129.155.155.5). Do not specify a URL here.

lcSource
The local source file to send to the server. Use a physical path or relative path.

lcTarget
Target file on the server either as just the file name or a server relative or current folder relative path.

lcUsername
Username for accessing the FTP server

lcPassword
Password for accessing the FTP server

Example

loFtp = CREATEOBJECT("wwSftp")
loFtp.nFtpPort = 23

lcHost = "127.0.0.1"
lcUsername = "tester"
lcPassword = "password"

lcSourceFile = ".\tests\sailbig.jpg"
lcTargetFile = "Sailbig.jpg"
lnResult = loFtp.FtpSendFile(lcHost,lcSourceFile,lcTargetFile,lcUsername,lcPassword)

this.AssertTrue(lnResult == 0,loFtp.cErrorMsg)

See also:

Class wwSFTP (deprecated)

© West Wind Technologies, 1996-2024 • Updated: 12/09/20
Comment or report problem with topic