CkSFtp Perl Reference Documentation

CkSFtp

Current Version: 9.5.0.75

SFTP implementation for file transfer and remote file management over SSH.

Object Creation

$obj = chilkat::CkSFtp->new();

Properties

AbortCurrent
# $boolVal is a boolean
$boolVal = $sFtp->get_AbortCurrent();
$sFtp->put_AbortCurrent($boolVal);
Introduced in version 9.5.0.58

When set to 1, causes the currently running method to abort. Methods that always finish quickly (i.e.have no length file operations or network communications) are not affected. If no method is running, then this property is automatically reset to 0 when the next method is called. When the abort occurs, this property is reset to 0. Both synchronous and asynchronous method calls can be aborted. (A synchronous method call could be aborted by setting this property from a separate thread.)

top
AccumulateBuffer
# $ckBytes is a CkByteData
$sFtp->get_AccumulateBuffer($ckBytes);

Contains the bytes downloaded from a remote file via the AccumulateBytes method call. Each call to AccumulateBytes appends to this buffer. To clear this buffer, call the ClearAccumulateBuffer method.

top
AuthFailReason
# $intVal is an integer
$intVal = $sFtp->get_AuthFailReason();
Introduced in version 9.5.0.52

Set to one of the following values if a call to AuthenticatePw, AuthenticatePk, or AuthenticatePwPk returns a failed status.

  • 1: Transport failure. This is a failure to communicate with the server (i.e. the connection was lost, or a read or write failed or timed out).
  • 2: Invalid key for public key authentication. The key was not a valid format, not a valid key, not a private key, or not the right type of key.
  • 3: No matching authentication methods were available.
  • 4: SSH authentication protocol error - an unexpected or invalid message was received.
  • 5: The incorrect password or private key was provided.
  • 6: Already authenticated. The SSH session is already authenticated.
  • 7: Password change request: The server requires the password to be changed.

top
BandwidthThrottleDown
# $intVal is an integer
$intVal = $sFtp->get_BandwidthThrottleDown();
$sFtp->put_BandwidthThrottleDown($intVal);
Introduced in version 9.5.0.49

If non-zero, limits (throttles) the download bandwidth to approximately this maximum number of bytes per second. The default value of this property is 0.

top
BandwidthThrottleUp
# $intVal is an integer
$intVal = $sFtp->get_BandwidthThrottleUp();
$sFtp->put_BandwidthThrottleUp($intVal);
Introduced in version 9.5.0.49

If non-zero, limits (throttles) the upload bandwidth to approximately this maximum number of bytes per second. The default value of this property is 0.

More Information and Examples
top
ClientIdentifier
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_ClientIdentifier($ckStr);
$strVal = $sFtp->clientIdentifier();
$sFtp->put_ClientIdentifier($strVal);

The client-identifier string to be used when connecting to an SSH/SFTP server. Defaults to "SSH-2.0-PuTTY_Release_0.63". (This string is used to mimic PuTTY because some servers are known to disconnect from clients with unknown client identifiers.)

top
ClientIpAddress
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_ClientIpAddress($ckStr);
$strVal = $sFtp->clientIpAddress();
$sFtp->put_ClientIpAddress($strVal);

The IP address to use for computers with multiple network interfaces or IP addresses. For computers with a single network interface (i.e. most computers), this property should not be set. For multihoming computers, the default IP address is automatically used if this property is not set.

The IP address is a string such as in dotted notation using numbers, not domain names, such as "165.164.55.124".

top
ConnectTimeoutMs
# $intVal is an integer
$intVal = $sFtp->get_ConnectTimeoutMs();
$sFtp->put_ConnectTimeoutMs($intVal);

Maximum number of milliseconds to wait when connecting to an SSH server.

top
DebugLogFilePath
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_DebugLogFilePath($ckStr);
$strVal = $sFtp->debugLogFilePath();
$sFtp->put_DebugLogFilePath($strVal);

If set to a file path, causes each Chilkat method or property call to automatically append it's LastErrorText to the specified log file. The information is appended such that if a hang or crash occurs, it is possible to see the context in which the problem occurred, as well as a history of all Chilkat calls up to the point of the problem. The VerboseLogging property can be set to provide more detailed information.

This property is typically used for debugging the rare cases where a Chilkat method call hangs or generates an exception that halts program execution (i.e. crashes). A hang or crash should generally never happen. The typical causes of a hang are:

  1. a timeout related property was set to 0 to explicitly indicate that an infinite timeout is desired,
  2. the hang is actually a hang within an event callback (i.e. it is a hang within the application code), or
  3. there is an internal problem (bug) in the Chilkat code that causes the hang.

top
DisconnectCode
# $intVal is an integer
$intVal = $sFtp->get_DisconnectCode();

If the SSH/SFTP server sent a DISCONNECT message when closing the connection, this property contains the "reason code" as specified in RFC 4253:

           Symbolic name                                reason code
           -------------                                -----------
      SSH_DISCONNECT_HOST_NOT_ALLOWED_TO_CONNECT             1
      SSH_DISCONNECT_PROTOCOL_ERROR                          2
      SSH_DISCONNECT_KEY_EXCHANGE_FAILED                     3
      SSH_DISCONNECT_RESERVED                                4
      SSH_DISCONNECT_MAC_ERROR                               5
      SSH_DISCONNECT_COMPRESSION_ERROR                       6
      SSH_DISCONNECT_SERVICE_NOT_AVAILABLE                   7
      SSH_DISCONNECT_PROTOCOL_VERSION_NOT_SUPPORTED          8
      SSH_DISCONNECT_HOST_KEY_NOT_VERIFIABLE                 9
      SSH_DISCONNECT_CONNECTION_LOST                        10
      SSH_DISCONNECT_BY_APPLICATION                         11
      SSH_DISCONNECT_TOO_MANY_CONNECTIONS                   12
      SSH_DISCONNECT_AUTH_CANCELLED_BY_USER                 13
      SSH_DISCONNECT_NO_MORE_AUTH_METHODS_AVAILABLE         14
      SSH_DISCONNECT_ILLEGAL_USER_NAME                      15

top
DisconnectReason
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_DisconnectReason($ckStr);
$strVal = $sFtp->disconnectReason();

If the SSH/SFTP server sent a DISCONNECT message when closing the connection, this property contains a descriptive string for the "reason code" as specified in RFC 4253.

top
EnableCache
# $boolVal is a boolean
$boolVal = $sFtp->get_EnableCache();
$sFtp->put_EnableCache($boolVal);

Controls whether the component keeps an internal file size & attribute cache. The cache affects the following methods: GetFileSize32, GetFileSize64, GetFileSizeStr, GetFileCreateTime, GetFileLastAccess, GetFileLastModified, GetFileOwner, GetFileGroup, and GetFilePermissions.

The file attribute cache exists to minimize communications with the SFTP server. If the cache is enabled, then a request for any single attribute will cause all of the attributes to be cached. A subsequent request for a different attribute of the same file will be fulfilled from cache, eliminating the need for a message to be sent to the SFTP server.

Note: Caching only occurs when filenames are used, not handles.

top
EnableCompression
# $boolVal is a boolean
$boolVal = $sFtp->get_EnableCompression();
$sFtp->put_EnableCompression($boolVal);
Introduced in version 9.5.0.56

Enables or disables the use of compression w/ the SSH connection. The default value is 1, meaning that compression is used if the server supports it.

Some older SSH servers have been found that claim to support compression, but actually fail when compression is used. PuTTY does not enable compression by default. If trouble is encountered where the SSH server disconnects immediately after the connection is seemingly established (i.e. during authentication), then check to see if disabling compression resolves the problem.

top
FilenameCharset
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_FilenameCharset($ckStr);
$strVal = $sFtp->filenameCharset();
$sFtp->put_FilenameCharset($strVal);

Automatically set during the InitializeSftp method if the server sends a filename-charset name-value extension. Otherwise, may be set directly to the name of a charset, such as "utf-8", "iso-8859-1", "windows-1252", etc. ("ansi" is also a valid choice.) Incoming filenames are interpreted as utf-8 if no FilenameCharset is set. Outgoing filenames are sent using utf-8 by default. Otherwise, incoming and outgoing filenames use the charset specified by this property.

top
ForceCipher
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_ForceCipher($ckStr);
$strVal = $sFtp->forceCipher();
$sFtp->put_ForceCipher($strVal);

Set to one of the following encryption algorithms to force that cipher to be used. By default, the component will automatically choose the first cipher supported by the server in the order listed here: "aes256-ctr", "aes128-ctr", "aes256-cbc", "aes128-cbc", "twofish256-cbc", "twofish128-cbc", "blowfish-cbc", "3des-cbc", "arcfour128", "arcfour256". (If blowfish is chosen, the encryption strength is 128 bits.)

Important: If this is property is set and the server does NOT support then encryption algorithm, then the Connect will fail.

top
ForceV3
# $boolVal is a boolean
$boolVal = $sFtp->get_ForceV3();
$sFtp->put_ForceV3($boolVal);

If set to 1, forces the client to choose version 3 of the SFTP protocol, even if the server supports a higher version. The default value of this property is 1.

top
HostKeyAlg
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_HostKeyAlg($ckStr);
$strVal = $sFtp->hostKeyAlg();
$sFtp->put_HostKeyAlg($strVal);

Indicates the preferred host key algorithm to be used in establishing the SSH secure connection. The default is "DSS". It may be changed to "RSA" if needed. Chilkat recommends not changing this unless a problem warrants the change.

top
HostKeyFingerprint
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_HostKeyFingerprint($ckStr);
$strVal = $sFtp->hostKeyFingerprint();

Set after connecting to an SSH/SFTP server. The format of the fingerprint looks like this: "ssh-rsa 1024 68:ff:d1:4e:6c:ff:d7:b0:d6:58:73:85:07:bc:2e:d5"

top
HttpProxyAuthMethod
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_HttpProxyAuthMethod($ckStr);
$strVal = $sFtp->httpProxyAuthMethod();
$sFtp->put_HttpProxyAuthMethod($strVal);

If an HTTP proxy requiring authentication is to be used, set this property to the HTTP proxy authentication method name. Valid choices are "Basic" or "NTLM".

top
HttpProxyDomain
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_HttpProxyDomain($ckStr);
$strVal = $sFtp->httpProxyDomain();
$sFtp->put_HttpProxyDomain($strVal);

The NTLM authentication domain (optional) if NTLM authentication is used w/ the HTTP proxy.

top
HttpProxyHostname
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_HttpProxyHostname($ckStr);
$strVal = $sFtp->httpProxyHostname();
$sFtp->put_HttpProxyHostname($strVal);

If an HTTP proxy is to be used, set this property to the HTTP proxy hostname or IPv4 address (in dotted decimal notation).

top
HttpProxyPassword
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_HttpProxyPassword($ckStr);
$strVal = $sFtp->httpProxyPassword();
$sFtp->put_HttpProxyPassword($strVal);

If an HTTP proxy requiring authentication is to be used, set this property to the HTTP proxy password.

top
HttpProxyPort
# $intVal is an integer
$intVal = $sFtp->get_HttpProxyPort();
$sFtp->put_HttpProxyPort($intVal);

If an HTTP proxy is to be used, set this property to the HTTP proxy port number. (Two commonly used HTTP proxy ports are 8080 and 3128.)

top
HttpProxyUsername
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_HttpProxyUsername($ckStr);
$strVal = $sFtp->httpProxyUsername();
$sFtp->put_HttpProxyUsername($strVal);

If an HTTP proxy requiring authentication is to be used, set this property to the HTTP proxy login name.

top
IdleTimeoutMs
# $intVal is an integer
$intVal = $sFtp->get_IdleTimeoutMs();
$sFtp->put_IdleTimeoutMs($intVal);

Causes SFTP operations to fail when progress for sending or receiving data halts for more than this number of milliseconds. Setting IdleTimeoutMs = 0 allows the application to wait indefinitely. The default value of this property is 30000 (which equals 30 seconds).

top
IncludeDotDirs
# $boolVal is a boolean
$boolVal = $sFtp->get_IncludeDotDirs();
$sFtp->put_IncludeDotDirs($boolVal);

If 1, then the ReadDir method will include the "." and ".." directories in its results. The default value of this property is 0.

top
InitializeFailCode
# $intVal is an integer
$intVal = $sFtp->get_InitializeFailCode();

The InitializeSftp method call opens a channel for the SFTP session. If the request to open a channel fails, this property contains a code that identifies the reason for failure. The reason codes are defined in RFC 4254 and are reproduced here:

             Symbolic name                           reason code
             -------------                           -----------
            SSH_OPEN_ADMINISTRATIVELY_PROHIBITED          1
            SSH_OPEN_CONNECT_FAILED                       2
            SSH_OPEN_UNKNOWN_CHANNEL_TYPE                 3
            SSH_OPEN_RESOURCE_SHORTAGE                    4

top
InitializeFailReason
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_InitializeFailReason($ckStr);
$strVal = $sFtp->initializeFailReason();

The InitializeSftp method call opens a channel for the SFTP session. If the request to open a channel fails, this property contains a description of the reason for failure. (It contains descriptive text matching the InitializeFailCode property.)

top
IsConnected
# $boolVal is a boolean
$boolVal = $sFtp->get_IsConnected();

Returns 1 if connected to the SSH server. Note: This does not mean authentication has happened or InitializeSftp has already succeeded. It only means that the connection has been established by calling Connect.

top
KeepSessionLog
# $boolVal is a boolean
$boolVal = $sFtp->get_KeepSessionLog();
$sFtp->put_KeepSessionLog($boolVal);

Controls whether communications to/from the SFTP server are saved to the SessionLog property. The default value is 0. If this property is set to 1, the contents of the SessionLog property will continuously grow as SFTP activity transpires. The purpose of the KeepSessionLog / SessionLog properties is to help in debugging any future problems that may arise.

top
LastErrorHtml
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_LastErrorHtml($ckStr);
$strVal = $sFtp->lastErrorHtml();

Provides information in HTML format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

top
LastErrorText
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_LastErrorText($ckStr);
$strVal = $sFtp->lastErrorText();

Provides information in plain-text format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

top
LastErrorXml
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_LastErrorXml($ckStr);
$strVal = $sFtp->lastErrorXml();

Provides information in XML format about the last method/property called. If a method call returns a value indicating failure, or behaves unexpectedly, examine this property to get more information.

top
LastMethodSuccess
# $boolVal is a boolean
$boolVal = $sFtp->get_LastMethodSuccess();
$sFtp->put_LastMethodSuccess($boolVal);
Introduced in version 9.5.0.52

Indicate whether the last method call succeeded or failed. A value of 1 indicates success, a value of 0 indicates failure. This property is automatically set for method calls. It is not modified by property accesses. The property is automatically set to indicate success for the following types of method calls:

  • Any method that returns a string.
  • Any method returning a Chilkat object, binary bytes, or a date/time.
  • Any method returning a standard boolean status value where success = 1 and failure = 0.
  • Any method returning an integer where failure is defined by a return value less than zero.

Note: Methods that do not fit the above requirements will always set this property equal to 1. For example, a method that returns no value (such as a "void" in C++) will technically always succeed.

top
MaxPacketSize
# $intVal is an integer
$intVal = $sFtp->get_MaxPacketSize();
$sFtp->put_MaxPacketSize($intVal);

The maximum packet length to be used in the underlying SSH transport protocol. The default value is 32768. (This should generally be left unchanged.)

top
PasswordChangeRequested
# $boolVal is a boolean
$boolVal = $sFtp->get_PasswordChangeRequested();

Set by the AuthenticatePw and AuthenticatePwPk methods. If the authenticate method returns a failed status, and this property is set to 1, then it indicates the server requested a password change. In this case, re-call the authenticate method, but provide both the old and new passwords in the following format, where vertical bar characters encapsulate the old and new passwords:

|oldPassword|newPassword|

top
PreferIpv6
# $boolVal is a boolean
$boolVal = $sFtp->get_PreferIpv6();
$sFtp->put_PreferIpv6($boolVal);

If 1, then use IPv6 over IPv4 when both are supported for a particular domain. The default value of this property is 0, which will choose IPv4 over IPv6.

top
PreserveDate
# $boolVal is a boolean
$boolVal = $sFtp->get_PreserveDate();
$sFtp->put_PreserveDate($boolVal);

If 1, then the file last-modified and create date/time will be preserved for downloaded and uploaded files. The default value is 0.

Note: Prior to version 9.5.0.40, this property only applied to downloads. Starting in v9.5.0.40, it also applies to the UploadFileByName method.

  • It does not apply to uploads or downloads where the remote file is opened to obtain a handle, the data is uploaded/downloaded, and then the handle is closed.
  • The last-mod date/times are always preserved ini the SyncTreeDownload and SyncTreeUpload methods.

top
ProtocolVersion
# $intVal is an integer
$intVal = $sFtp->get_ProtocolVersion();

The negotiated SFTP protocol version, which should be a value between 3 and 6 inclusive. When the InitializeSftp method is called, the Chilkat SFTP client sends it's highest supported protocol version to the server, and the server sends it's SFTP protocol version in response. The negotiated protocol (i.e. the protocol version used for the session) is the lower of the two numbers. If the SFTP server's protocol version is lower than 6, some file date/attributes are not supported because they are not supported by the earlier protocol version. These exceptions are noted throughout the reference documentation.

top
ReadDirMustMatch
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_ReadDirMustMatch($ckStr);
$strVal = $sFtp->readDirMustMatch();
$sFtp->put_ReadDirMustMatch($strVal);
Introduced in version 9.5.0.53

Can contain a wildcarded list of file patterns separated by semicolons. For example, "*.xml; *.txt; *.csv". If set, the ReadDir method will only return files that match any one of these patterns.

top
ReadDirMustNotMatch
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_ReadDirMustNotMatch($ckStr);
$strVal = $sFtp->readDirMustNotMatch();
$sFtp->put_ReadDirMustNotMatch($strVal);
Introduced in version 9.5.0.53

Can contain a wildcarded list of file patterns separated by semicolons. For example, "*.xml; *.txt; *.csv". If set, the ReadDir method will only return files that do not match any of these patterns.

top
ServerIdentifier
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_ServerIdentifier($ckStr);
$strVal = $sFtp->serverIdentifier();
Introduced in version 9.5.0.71

The server-identifier string received from the server during connection establishment. For example, a typical value would be similar to "SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.2".

top
SessionLog
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_SessionLog($ckStr);
$strVal = $sFtp->sessionLog();

Contains a log of the messages sent to/from the SFTP server. To enable session logging, set the KeepSessionLog property = 1. Note: This property is not a filename -- it is a string property that contains the session log data.

top
SocksHostname
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_SocksHostname($ckStr);
$strVal = $sFtp->socksHostname();
$sFtp->put_SocksHostname($strVal);

The SOCKS4/SOCKS5 hostname or IPv4 address (in dotted decimal notation). This property is only used if the SocksVersion property is set to 4 or 5).

top
SocksPassword
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_SocksPassword($ckStr);
$strVal = $sFtp->socksPassword();
$sFtp->put_SocksPassword($strVal);

The SOCKS5 password (if required). The SOCKS4 protocol does not include the use of a password, so this does not apply to SOCKS4.

top
SocksPort
# $intVal is an integer
$intVal = $sFtp->get_SocksPort();
$sFtp->put_SocksPort($intVal);

The SOCKS4/SOCKS5 proxy port. The default value is 1080. This property only applies if a SOCKS proxy is used (if the SocksVersion property is set to 4 or 5).

top
SocksUsername
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_SocksUsername($ckStr);
$strVal = $sFtp->socksUsername();
$sFtp->put_SocksUsername($strVal);

The SOCKS4/SOCKS5 proxy username. This property is only used if the SocksVersion property is set to 4 or 5).

top
SocksVersion
# $intVal is an integer
$intVal = $sFtp->get_SocksVersion();
$sFtp->put_SocksVersion($intVal);

SocksVersion May be set to one of the following integer values:

0 - No SOCKS proxy is used. This is the default.
4 - Connect via a SOCKS4 proxy.
5 - Connect via a SOCKS5 proxy.

top
SoRcvBuf
# $intVal is an integer
$intVal = $sFtp->get_SoRcvBuf();
$sFtp->put_SoRcvBuf($intVal);

Sets the receive buffer size socket option. Normally, this property should be left unchanged. The default value is 4194304.

This property can be increased if download performance seems slow. It is recommended to be a multiple of 4096.

top
SoSndBuf
# $intVal is an integer
$intVal = $sFtp->get_SoSndBuf();
$sFtp->put_SoSndBuf($intVal);

Sets the send buffer size socket option. Normally, this property should be left unchanged. The default value is 262144.

This property can be increased if upload performance seems slow. It is recommended to be a multiple of 4096. Testing with sizes such as 512K and 1MB is reasonable.

top
SyncDirectives
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_SyncDirectives($ckStr);
$strVal = $sFtp->syncDirectives();
$sFtp->put_SyncDirectives($strVal);
Introduced in version 9.5.0.58

A property that can contain a list of comma-separated keywords to control certain aspects of an upload or download synchronization (for the SyncTreeUpload and SyncTreeDownload methods). At this time there is only one possible directive, but others may be added in the future.

Set this property to "UploadIgnoreLocalOpenFailures" to skip local files that cannot be opened. A common reason for this would be if another process on the system has the file open for exclusive access.

top
SyncedFiles
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_SyncedFiles($ckStr);
$strVal = $sFtp->syncedFiles();
$sFtp->put_SyncedFiles($strVal);
Introduced in version 9.5.0.51

The paths of the files uploaded or downloaded in the last call to SyncUploadTree or SyncDownloadTree. The paths are listed one per line. In both cases (for upload and download) each line contains the paths relative to the root synced directory.

top
SyncMustMatch
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_SyncMustMatch($ckStr);
$strVal = $sFtp->syncMustMatch();
$sFtp->put_SyncMustMatch($strVal);

Can contain a wildcarded list of file patterns separated by semicolons. For example, "*.xml; *.txt; *.csv". If set, the SyncTreeUpload and SyncTreeDownload methods will only transfer files that match any one of these patterns. This property only applies to files. It does not apply to sub-directory names when recursively traversing a directory tree.

top
SyncMustNotMatch
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_SyncMustNotMatch($ckStr);
$strVal = $sFtp->syncMustNotMatch();
$sFtp->put_SyncMustNotMatch($strVal);

Can contain a wildcarded list of file patterns separated by semicolons. For example, "*.xml; *.txt; *.csv". If set, the SyncTreeUpload and SyncTreeDownload methods will not transfer files that match any one of these patterns. This property only applies to files. It does not apply to sub-directory names when recursively traversing a directory tree.

top
TcpNoDelay
# $boolVal is a boolean
$boolVal = $sFtp->get_TcpNoDelay();
$sFtp->put_TcpNoDelay($boolVal);

This property controls the use of the internal TCP_NODELAY socket option (which disables the Nagle algorithm). The default value of this property is 0. Setting this value to 1 disables the delay of sending successive small packets on the network.

top
UncommonOptions
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_UncommonOptions($ckStr);
$strVal = $sFtp->uncommonOptions();
$sFtp->put_UncommonOptions($strVal);
Introduced in version 9.5.0.73

This is a catch-all property to be used for uncommon needs. This property defaults to the empty string, and should typically remain empty.

As of v9.5.0.73, the only possible value is:

  • "KEX_DH_GEX_REQUEST_OLD" - Force the old Group Exchange message to be used. This would be used for very old SSH server implementations that do not use the RFC standard for diffie-hellman-group-exchange.

top
UploadChunkSize
# $intVal is an integer
$intVal = $sFtp->get_UploadChunkSize();
$sFtp->put_UploadChunkSize($intVal);

The chunk size to use when uploading files via the UploadFile or UploadFileByName methods. The default value is 32000. If an upload fails because "WSAECONNABORTED An established connection was aborted by the software in your host machine.", then try setting this property to a smaller value, such as 4096. A smaller value will result in slower transfer rates, but may help avoid this problem.

top
UtcMode
# $boolVal is a boolean
$boolVal = $sFtp->get_UtcMode();
$sFtp->put_UtcMode($boolVal);

If 1, then date/times are returned as UTC times. If 0 (the default) then date/times are returned as local times.

top
Utf8
# $boolVal is a boolean
$boolVal = $sFtp->get_Utf8();
$sFtp->put_Utf8($boolVal);

When set to 1, all "const char *" arguments are interpreted as utf-8 strings. If set to 0 (the default), then "const char *" arguments are interpreted as ANSI strings. Also, when set to 1, and Chilkat method returning a "const char *" is returning the utf-8 representation. If set to 0, all "const char *" return values are ANSI strings.

top
VerboseLogging
# $boolVal is a boolean
$boolVal = $sFtp->get_VerboseLogging();
$sFtp->put_VerboseLogging($boolVal);

If set to 1, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. The default value is 0. Verbose logging should only be used for debugging. The potentially large quantity of logged information may adversely affect peformance.

top
Version
# $strVal is a string
# $ckStr is a CkString
$sFtp->get_Version($ckStr);
$strVal = $sFtp->version();

Version of the component/library, such as "9.5.0.63"

top
XferByteCount
# $intVal is a unsigned long
$intVal = $sFtp->get_XferByteCount();
Introduced in version 9.5.0.71

The current transfer byte count for an ongoing upload or download. Programs doing asynchronous uploads or downloads can read this property in real time during the upload. For SyncTreeUpload and SyncTreeDownload operations, this is the real-time cumulative number of bytes for all files uploaded or downloaded.

top
XferByteCount64
# $int64Val is a 64-bit integer
$int64Val = $sFtp->get_XferByteCount64();
Introduced in version 9.5.0.71

The current transfer byte count for an ongoing upload or download. Programs doing asynchronous uploads or downloads can read this property in real time during the upload. For SyncTreeUpload and SyncTreeDownload operations, this is the real-time cumulative number of bytes for all files uploaded or downloaded.

top

Methods

AccumulateBytes
# $handle is a string
# $maxBytes is an integer
$retInt = $sFtp->AccumulateBytes($handle, $maxBytes);

Downloads bytes from an open file and appends them to the AccumulateBuffer. The handle is a file handle returned by the OpenFile method. The maxBytes is the maximum number of bytes to read. If the end-of-file is reached prior to reading the number of requested bytes, then fewer bytes may be returned.

Returns the number of bytes downloaded and appended to AccumulateBuffer. Returns -1 on error.

top
AccumulateBytesAsync (1)
# returns a CkTask
# $handle is a string
# $maxBytes is an integer
$ret_task = $sFtp->AccumulateBytesAsync($handle, $maxBytes);

Creates an asynchronous task to call the AccumulateBytes method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
Add64
# $n1 is a string
# $n2 is a string
# $outStr is a CkString (output)
$status = $sFtp->Add64($n1, $n2, $outStr);
$retStr = $sFtp->add64($n1, $n2);

Convenience method for 64-bit addition. Allows for two 64-bit integers to be passed as decimal strings and returns the sum in a decimal sting.

Returns 1 for success, 0 for failure.

top
AuthenticatePk
# $username is a string
# $privateKey is a CkSshKey
$status = $sFtp->AuthenticatePk($username, $privateKey);

Authenticates with the SSH server using public-key authentication. The corresponding public key must have been installed on the SSH server for the username. Authentication will succeed if the matching privateKey is provided.

Important: When reporting problems, please send the full contents of the LastErrorText property to support@chilkatsoft.com.

Returns 1 for success, 0 for failure.

More Information and Examples
top
AuthenticatePkAsync (1)
# returns a CkTask
# $username is a string
# $privateKey is a CkSshKey
$ret_task = $sFtp->AuthenticatePkAsync($username, $privateKey);

Creates an asynchronous task to call the AuthenticatePk method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
AuthenticatePw
# $login is a string
# $password is a string
$status = $sFtp->AuthenticatePw($login, $password);

Authenticates with the SSH server using a login and password.

An SFTP session always begins by first calling Connect to connect to the SSH server, then calling either AuthenticatePw or AuthenticatePk to login, and finally calling InitializeSftp.

Important: When reporting problems, please send the full contents of the LastErrorText property to support@chilkatsoft.com.

Note: To learn about how to handle password change requests, see the PasswordChangeRequested property (above).

Returns 1 for success, 0 for failure.

top
AuthenticatePwAsync (1)
# returns a CkTask
# $login is a string
# $password is a string
$ret_task = $sFtp->AuthenticatePwAsync($login, $password);

Creates an asynchronous task to call the AuthenticatePw method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
AuthenticatePwPk
# $username is a string
# $password is a string
# $privateKey is a CkSshKey
$status = $sFtp->AuthenticatePwPk($username, $password, $privateKey);

Authentication for SSH servers that require both a password and private key. (Most SSH servers are configured to require one or the other, but not both.)

Important: When reporting problems, please send the full contents of the LastErrorText property to support@chilkatsoft.com.

Returns 1 for success, 0 for failure.

top
AuthenticatePwPkAsync (1)
# returns a CkTask
# $username is a string
# $password is a string
# $privateKey is a CkSshKey
$ret_task = $sFtp->AuthenticatePwPkAsync($username, $password, $privateKey);

Creates an asynchronous task to call the AuthenticatePwPk method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
AuthenticateSecPw
# $login is a CkSecureString
# $password is a CkSecureString
$status = $sFtp->AuthenticateSecPw($login, $password);
Introduced in version 9.5.0.71

The same as AuthenticatePw, but the login and password are passed in secure string objects.

Returns 1 for success, 0 for failure.

More Information and Examples
top
AuthenticateSecPwAsync (1)
# returns a CkTask
# $login is a CkSecureString
# $password is a CkSecureString
$ret_task = $sFtp->AuthenticateSecPwAsync($login, $password);
Introduced in version 9.5.0.71

Creates an asynchronous task to call the AuthenticateSecPw method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
AuthenticateSecPwPk
# $username is a CkSecureString
# $password is a CkSecureString
# $privateKey is a CkSshKey
$status = $sFtp->AuthenticateSecPwPk($username, $password, $privateKey);
Introduced in version 9.5.0.71

The same as AuthenticatePwPk, but the login and password are passed in secure string objects.

Returns 1 for success, 0 for failure.

top
AuthenticateSecPwPkAsync (1)
# returns a CkTask
# $username is a CkSecureString
# $password is a CkSecureString
# $privateKey is a CkSshKey
$ret_task = $sFtp->AuthenticateSecPwPkAsync($username, $password, $privateKey);
Introduced in version 9.5.0.71

Creates an asynchronous task to call the AuthenticateSecPwPk method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
ClearAccumulateBuffer
$sFtp->ClearAccumulateBuffer();

Clears the contents of the AccumulateBuffer property.

top
ClearCache
$sFtp->ClearCache();

Clears the internal file attribute cache. (Please refer to the EnableCache property for more information about the file attribute cache.)

top
ClearSessionLog
$sFtp->ClearSessionLog();

Clears the contents of the SessionLog property.

top
CloseHandle
# $handle is a string
$status = $sFtp->CloseHandle($handle);

Closes a file on the SSH/SFTP server. handle is a file handle returned from a previous call to OpenFile or OpenDir.

Returns 1 for success, 0 for failure.

top
CloseHandleAsync (1)
# returns a CkTask
# $handle is a string
$ret_task = $sFtp->CloseHandleAsync($handle);

Creates an asynchronous task to call the CloseHandle method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
Connect
# $domainName is a string
# $port is an integer
$status = $sFtp->Connect($domainName, $port);

Connects to an SSH/SFTP server. The domainName may be a domain name or an IP address (example: 192.168.1.10). Both IPv4 and IPv6 addresses are supported. The port is typically 22, which is the standard port for SSH servers.

An SFTP session always begins by first calling Connect to connect to the SSH server, then calling either AuthenticatePw or AuthenticatePk to login, and finally calling InitializeSftp.

Important: When reporting problems, please send the full contents of the LastErrorText property to support@chilkatsoft.com.

Important: All TCP-based Internet communications, regardless of the protocol (such as HTTP, FTP, SSH, IMAP, POP3, SMTP, etc.), and regardless of SSL/TLS, begin with establishing a TCP connection to a remote host:port. External security-related infrastructure such as software firewalls (Windows Firewall), hardware firewalls, anti-virus, at either source or destination (or both) can block the connection. If the connection fails, make sure to check all potential external causes of blockage.

Returns 1 for success, 0 for failure.

top
ConnectAsync (1)
# returns a CkTask
# $domainName is a string
# $port is an integer
$ret_task = $sFtp->ConnectAsync($domainName, $port);

Creates an asynchronous task to call the Connect method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
ConnectThroughSsh
# $sshConn is a CkSsh
# $hostname is a string
# $port is an integer
$status = $sFtp->ConnectThroughSsh($sshConn, $hostname, $port);
Introduced in version 9.5.0.55

Connects to an SSH/SFTP server through an existing SSH connection. The sshConn is an existing connected and authenticated SSH object. The connection to hostname:port is made through the existing SSH connection via port-forwarding. If successful, the connection is as follows: application => ServerSSH1 => ServerSSH2. (where ServerSSH1 is the sshConn and ServerSSH2 is the SSH server at hostname:port) Once connected in this way, all communications are routed through ServerSSH1 to ServerSSH2. This includes authentication -- which means the application must still call one of the Authenticate* methods to authenticate with ServerSSH2.

Returns 1 for success, 0 for failure.

More Information and Examples
top
ConnectThroughSshAsync (1)
# returns a CkTask
# $sshConn is a CkSsh
# $hostname is a string
# $port is an integer
$ret_task = $sFtp->ConnectThroughSshAsync($sshConn, $hostname, $port);
Introduced in version 9.5.0.55

Creates an asynchronous task to call the ConnectThroughSsh method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
CopyFileAttr
# $localFilename is a string
# $remoteFilename is a string
# $isHandle is a boolean
$status = $sFtp->CopyFileAttr($localFilename, $remoteFilename, $isHandle);

Sets the date/time and other attributes of a remote file to be equal to that of a local file.

The attributes copied depend on the SFTP version of the server:

<b>SFTP v3 (and below)</b>
    Last-Modified Date/Time
    Last-Access Date/Time

<b>SFTP v4, v5</b>
    Last-Modified Date/Time
    Last-Access Date/Time
    Create Date/Time

<b>SFTP v6 (and above)</b>
    Last-Modified Date/Time
    Last-Access Date/Time
    Create Date/Time
    Read-Only Flag
    Hidden Flag
    Archive Flag
    Compressed Flag
    Encrypted Flag

Notes:
(1) The Last-Access date/time may or may not be set. Chilkat has found that the Last-Access time is set to the current date/time, which is probably a result of the operating system setting it based on when the SFTP server is touching the file.
(2) At the time of this writing, it is unknown whether the compressed/encryption settings for a local file are transferred to the remote file. For example, does the remote file become compressed and/or encrypted just by setting the flags? It may depend on the SFTP server and/or the remote filesystem.
(3) Dates/times are sent in GMT. SFTP servers should convert GMT times to local time zones.

Returns 1 for success, 0 for failure.

top
CopyFileAttrAsync (1)
# returns a CkTask
# $localFilename is a string
# $remoteFilename is a string
# $isHandle is a boolean
$ret_task = $sFtp->CopyFileAttrAsync($localFilename, $remoteFilename, $isHandle);

Creates an asynchronous task to call the CopyFileAttr method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
CreateDir
# $path is a string
$status = $sFtp->CreateDir($path);

Creates a directory on the SFTP server.

Returns 1 for success, 0 for failure.

top
CreateDirAsync (1)
# returns a CkTask
# $path is a string
$ret_task = $sFtp->CreateDirAsync($path);

Creates an asynchronous task to call the CreateDir method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
Disconnect
$sFtp->Disconnect();

Disconnects from the SSH server.

top
DownloadBd
# $remoteFilePath is a string
# $binData is a CkBinData
$status = $sFtp->DownloadBd($remoteFilePath, $binData);
Introduced in version 9.5.0.62

Downloads the contents of a remote file to a BinData object. (Appends to the BinData.)

Returns 1 for success, 0 for failure.

More Information and Examples
top
DownloadBdAsync (1)
# returns a CkTask
# $remoteFilePath is a string
# $binData is a CkBinData
$ret_task = $sFtp->DownloadBdAsync($remoteFilePath, $binData);
Introduced in version 9.5.0.62

Creates an asynchronous task to call the DownloadBd method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
DownloadFile
# $handle is a string
# $toFilename is a string
$status = $sFtp->DownloadFile($handle, $toFilename);

Downloads a file from the SSH server to the local filesystem. There are no limitations on file size and the data is streamed from SSH server to the local file. handle is a file handle returned by a previous call to OpenFile.

Returns 1 for success, 0 for failure.

top
DownloadFileAsync (1)
# returns a CkTask
# $handle is a string
# $toFilename is a string
$ret_task = $sFtp->DownloadFileAsync($handle, $toFilename);

Creates an asynchronous task to call the DownloadFile method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
DownloadFileByName
# $remoteFilePath is a string
# $localFilePath is a string
$status = $sFtp->DownloadFileByName($remoteFilePath, $localFilePath);

Simplified method for downloading files.

The last-modified date/time is only preserved when the PreserveDate property is set to 1. (The default value of PreserveDate is 0.)

Returns 1 for success, 0 for failure.

top
DownloadFileByNameAsync (1)
# returns a CkTask
# $remoteFilePath is a string
# $localFilePath is a string
$ret_task = $sFtp->DownloadFileByNameAsync($remoteFilePath, $localFilePath);

Creates an asynchronous task to call the DownloadFileByName method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
DownloadSb
# $remoteFilePath is a string
# $charset is a string
# $sb is a CkStringBuilder
$status = $sFtp->DownloadSb($remoteFilePath, $charset, $sb);
Introduced in version 9.5.0.62

Downloads the contents of a remote file to a StringBuilder object. (Appends to the StringBuilder.)

Returns 1 for success, 0 for failure.

top
DownloadSbAsync (1)
# returns a CkTask
# $remoteFilePath is a string
# $charset is a string
# $sb is a CkStringBuilder
$ret_task = $sFtp->DownloadSbAsync($remoteFilePath, $charset, $sb);
Introduced in version 9.5.0.62

Creates an asynchronous task to call the DownloadSb method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
Eof
# $handle is a string
$retBool = $sFtp->Eof($handle);

Returns 1 if the last read operation for a handle reached the end of file. Otherwise returns 0. If an invalid handle is passed, a value of 1 is returned.

top
FileExists
# $remotePath is a string
# $followLinks is a boolean
$retInt = $sFtp->FileExists($remotePath, $followLinks);
Introduced in version 9.5.0.67

Returns a value to indicate whether the remote file exists or not. remotePath is the path of the remote file. If followLinks is 1, then symbolic links will be followed on the server.

This method returns one of the following possible values:

  • -1: Unable to check. Examine the LastErrorText to determine the reason for failure.
  • 0: File does not exist.
  • 1: The regular file exists.
  • 2: It exists, but it is a directory.
  • 3: It exists, but it is a symlink (only possible if followLinks is 0)
  • 4: It exists, but it is a special filesystem entry type.
  • 5: It exists, but it is an unkown filesystem entry type.
  • 6: It exists, but it is an socket filesystem entry type.
  • 7: It exists, but it is an char device entry type.
  • 8: It exists, but it is an block device entry type.
  • 9: It exists, but it is an FIFO entry type.

Note: The values greater than zero correspond to the possible values as specified in the SFTP protocol specification. A given value may not make sense on all operating systems.

top
FileExistsAsync (1)
# returns a CkTask
# $remotePath is a string
# $followLinks is a boolean
$ret_task = $sFtp->FileExistsAsync($remotePath, $followLinks);
Introduced in version 9.5.0.67

Creates an asynchronous task to call the FileExists method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
Fsync
# $handle is a string
$status = $sFtp->Fsync($handle);
Introduced in version 9.5.0.71

Causes the SFTP server to do an fsync on the open file. Specifically, this is directing the SFTP server to call fsync (https://linux.die.net/man/2/fsync) on the open file.

This method uses the fsync@openssh.com and only works for servers supporting the fsync@openssh.com extension.

Returns 1 for success, 0 for failure.

More Information and Examples
top
FsyncAsync (1)
# returns a CkTask
# $handle is a string
$ret_task = $sFtp->FsyncAsync($handle);
Introduced in version 9.5.0.71

Creates an asynchronous task to call the Fsync method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
GetFileCreateDt
# returns a CkDateTime
# $pathOrHandle is a string
# $bFollowLinks is a boolean
# $bIsHandle is a boolean
$ret_ckDateTime = $sFtp->GetFileCreateDt($pathOrHandle, $bFollowLinks, $bIsHandle);

Returns the create date/time for a file. pathOrHandle may be a remote filepath or an open handle string as returned by OpenFile. If pathOrHandle is a handle, then bIsHandle must be set to 1, otherwise it should be 0. If bFollowLinks is 1, then symbolic links will be followed on the server.

Note: Servers running the SFTP v3 protocol or lower do not have the ability to return a file's creation date/time.

Returns null on failure

top
GetFileCreateDtAsync (1) (2)
# returns a CkTask
# $pathOrHandle is a string
# $bFollowLinks is a boolean
# $bIsHandle is a boolean
$ret_task = $sFtp->GetFileCreateDtAsync($pathOrHandle, $bFollowLinks, $bIsHandle);

Creates an asynchronous task to call the GetFileCreateDt method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
GetFileCreateTimeStr
# $pathOrHandle is a string
# $bFollowLinks is a boolean
# $bIsHandle is a boolean
# $outStr is a CkString (output)
$status = $sFtp->GetFileCreateTimeStr($pathOrHandle, $bFollowLinks, $bIsHandle, $outStr);
$retStr = $sFtp->getFileCreateTimeStr($pathOrHandle, $bFollowLinks, $bIsHandle);

The same as GetFileCreateTime, except the date/time is returned as an RFC822 formatted string.

Returns 1 for success, 0 for failure.

top
GetFileCreateTimeStrAsync (1)
# returns a CkTask
# $pathOrHandle is a string
# $bFollowLinks is a boolean
# $bIsHandle is a boolean
$ret_task = $sFtp->GetFileCreateTimeStrAsync($pathOrHandle, $bFollowLinks, $bIsHandle);

Creates an asynchronous task to call the GetFileCreateTimeStr method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
GetFileGroup
# $pathOrHandle is a string
# $bFollowLinks is a boolean
# $bIsHandle is a boolean
# $outStr is a CkString (output)
$status = $sFtp->GetFileGroup($pathOrHandle, $bFollowLinks, $bIsHandle, $outStr);
$retStr = $sFtp->getFileGroup($pathOrHandle, $bFollowLinks, $bIsHandle);

Returns the group of a file. pathOrHandle may be a remote filepath or an open handle string as returned by OpenFile. If pathOrHandle is a handle, then bIsHandle must be set to 1, otherwise it should be 0. If bFollowLinks is 1, then symbolic links will be followed on the server.

Note: Servers running the SFTP v3 protocol or lower do not have the ability to return a file's group name. Instead, the decimal GID of the file is returned.

Returns 1 for success, 0 for failure.

top
GetFileGroupAsync (1)
# returns a CkTask
# $pathOrHandle is a string
# $bFollowLinks is a boolean
# $bIsHandle is a boolean
$ret_task = $sFtp->GetFileGroupAsync($pathOrHandle, $bFollowLinks, $bIsHandle);

Creates an asynchronous task to call the GetFileGroup method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
GetFileLastAccessDt
# returns a CkDateTime
# $pathOrHandle is a string
# $bFollowLinks is a boolean
# $bIsHandle is a boolean
$ret_ckDateTime = $sFtp->GetFileLastAccessDt($pathOrHandle, $bFollowLinks, $bIsHandle);

Returns the last-access date/time for a file. pathOrHandle may be a remote filepath or an open handle string as returned by OpenFile. If pathOrHandle is a handle, then bIsHandle must be set to 1, otherwise it should be 0. If bFollowLinks is 1, then symbolic links will be followed on the server.

Returns null on failure

top
GetFileLastAccessDtAsync (1) (2)
# returns a CkTask
# $pathOrHandle is a string
# $bFollowLinks is a boolean
# $bIsHandle is a boolean
$ret_task = $sFtp->GetFileLastAccessDtAsync($pathOrHandle, $bFollowLinks, $bIsHandle);

Creates an asynchronous task to call the GetFileLastAccessDt method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
GetFileLastAccessStr
# $pathOrHandle is a string
# $bFollowLinks is a boolean
# $bIsHandle is a boolean
# $outStr is a CkString (output)
$status = $sFtp->GetFileLastAccessStr($pathOrHandle, $bFollowLinks, $bIsHandle, $outStr);
$retStr = $sFtp->getFileLastAccessStr($pathOrHandle, $bFollowLinks, $bIsHandle);

The same as GetFileLastAccess, except the date/time is returned as an RFC822 formatted string.

Returns 1 for success, 0 for failure.

top
GetFileLastAccessStrAsync (1)
# returns a CkTask
# $pathOrHandle is a string
# $bFollowLinks is a boolean
# $bIsHandle is a boolean
$ret_task = $sFtp->GetFileLastAccessStrAsync($pathOrHandle, $bFollowLinks, $bIsHandle);

Creates an asynchronous task to call the GetFileLastAccessStr method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
GetFileLastModifiedDt
# returns a CkDateTime
# $pathOrHandle is a string
# $bFollowLinks is a boolean
# $bIsHandle is a boolean
$ret_ckDateTime = $sFtp->GetFileLastModifiedDt($pathOrHandle, $bFollowLinks, $bIsHandle);

Returns the last-modified date/time for a file. pathOrHandle may be a remote filepath or an open handle string as returned by OpenFile. If pathOrHandle is a handle, then bIsHandle must be set to 1, otherwise it should be 0. If bFollowLinks is 1, then symbolic links will be followed on the server.

Returns null on failure

top
GetFileLastModifiedDtAsync (1) (2)
# returns a CkTask
# $pathOrHandle is a string
# $bFollowLinks is a boolean
# $bIsHandle is a boolean
$ret_task = $sFtp->GetFileLastModifiedDtAsync($pathOrHandle, $bFollowLinks, $bIsHandle);

Creates an asynchronous task to call the GetFileLastModifiedDt method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
GetFileLastModifiedStr
# $pathOrHandle is a string
# $bFollowLinks is a boolean
# $bIsHandle is a boolean
# $outStr is a CkString (output)
$status = $sFtp->GetFileLastModifiedStr($pathOrHandle, $bFollowLinks, $bIsHandle, $outStr);
$retStr = $sFtp->getFileLastModifiedStr($pathOrHandle, $bFollowLinks, $bIsHandle);

The same as GetFileLastModified, except the date/time is returned as an RFC822 formatted string.

Returns 1 for success, 0 for failure.

top
GetFileLastModifiedStrAsync (1)
# returns a CkTask
# $pathOrHandle is a string
# $bFollowLinks is a boolean
# $bIsHandle is a boolean
$ret_task = $sFtp->GetFileLastModifiedStrAsync($pathOrHandle, $bFollowLinks, $bIsHandle);

Creates an asynchronous task to call the GetFileLastModifiedStr method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
GetFileOwner
# $pathOrHandle is a string
# $bFollowLinks is a boolean
# $bIsHandle is a boolean
# $outStr is a CkString (output)
$status = $sFtp->GetFileOwner($pathOrHandle, $bFollowLinks, $bIsHandle, $outStr);
$retStr = $sFtp->getFileOwner($pathOrHandle, $bFollowLinks, $bIsHandle);

Returns the owner of a file. pathOrHandle may be a remote filepath or an open handle string as returned by OpenFile. If pathOrHandle is a handle, then bIsHandle must be set to 1, otherwise it should be 0. If bFollowLinks is 1, then symbolic links will be followed on the server.

Note: Servers running the SFTP v3 protocol or lower do not have the ability to return a file's owner name. Instead, the decimal UID of the file is returned.

Returns 1 for success, 0 for failure.

top
GetFileOwnerAsync (1)
# returns a CkTask
# $pathOrHandle is a string
# $bFollowLinks is a boolean
# $bIsHandle is a boolean
$ret_task = $sFtp->GetFileOwnerAsync($pathOrHandle, $bFollowLinks, $bIsHandle);

Creates an asynchronous task to call the GetFileOwner method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
GetFilePermissions
# $pathOrHandle is a string
# $bFollowLinks is a boolean
# $bIsHandle is a boolean
$retInt = $sFtp->GetFilePermissions($pathOrHandle, $bFollowLinks, $bIsHandle);

Returns the access permisssions flags of a file. pathOrHandle may be a remote filepath or an open handle string as returned by OpenFile. If pathOrHandle is a handle, then bIsHandle must be set to 1, otherwise it should be 0. If bFollowLinks is 1, then symbolic links will be followed on the server.

top
GetFilePermissionsAsync (1)
# returns a CkTask
# $pathOrHandle is a string
# $bFollowLinks is a boolean
# $bIsHandle is a boolean
$ret_task = $sFtp->GetFilePermissionsAsync($pathOrHandle, $bFollowLinks, $bIsHandle);

Creates an asynchronous task to call the GetFilePermissions method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
GetFileSize32
# $pathOrHandle is a string
# $bFollowLinks is a boolean
# $bIsHandle is a boolean
$retInt = $sFtp->GetFileSize32($pathOrHandle, $bFollowLinks, $bIsHandle);

Returns the size in bytes of a file on the SSH server. If the file size exceeds what can be represented in 32-bits, a value of -1 is returned. pathOrHandle may be a remote filepath or an open handle string as returned by OpenFile. If pathOrHandle is a handle, then bIsHandle must be set to 1, otherwise it should be 0. If bFollowLinks is 1, then symbolic links will be followed on the server.

top
GetFileSize64
# $pathOrHandle is a string
# $bFollowLinks is a boolean
# $bIsHandle is a boolean
$retInt64 = $sFtp->GetFileSize64($pathOrHandle, $bFollowLinks, $bIsHandle);

Returns a 64-bit integer containing the size (in bytes) of a file on the SSH server. pathOrHandle may be a remote filepath or an open handle string as returned by OpenFile. If pathOrHandle is a handle, then bIsHandle must be set to 1, otherwise it should be 0. If bFollowLinks is 1, then symbolic links will be followed on the server.

top
GetFileSizeStr
# $pathOrHandle is a string
# $bFollowLinks is a boolean
# $bIsHandle is a boolean
# $outStr is a CkString (output)
$status = $sFtp->GetFileSizeStr($pathOrHandle, $bFollowLinks, $bIsHandle, $outStr);
$retStr = $sFtp->getFileSizeStr($pathOrHandle, $bFollowLinks, $bIsHandle);

Returns the size in bytes (in decimal string form) of a file on the SSH server. pathOrHandle may be a remote filepath or an open handle string as returned by OpenFile. If pathOrHandle is a handle, then bIsHandle must be set to 1, otherwise it should be 0. If bFollowLinks is 1, then symbolic links will be followed on the server.

Note: This method exists for environments that do not have 64-bit integer support. The Add64 method is provided for 64-bit addition, and other methods such as ReadFileBytes64s allow for 64-bit values to be passed as strings.

Returns 1 for success, 0 for failure.

top
HardLink
# $oldPath is a string
# $newPath is a string
$status = $sFtp->HardLink($oldPath, $newPath);
Introduced in version 9.5.0.71

Creates a hard link on the server using the hardlink@openssh.com extension. This only works for SFTP servers that support the hardlink@openssh.com extension.

Returns 1 for success, 0 for failure.

top
HardLinkAsync (1)
# returns a CkTask
# $oldPath is a string
# $newPath is a string
$ret_task = $sFtp->HardLinkAsync($oldPath, $newPath);
Introduced in version 9.5.0.71

Creates an asynchronous task to call the HardLink method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
InitializeSftp
$status = $sFtp->InitializeSftp();

Intializes the SFTP subsystem. This should be called after connecting and authenticating. An SFTP session always begins by first calling Connect to connect to the SSH server, then calling either AuthenticatePw or AuthenticatePk to login, and finally calling InitializeSftp.

Important: When reporting problems, please send the full contents of the LastErrorText property to support@chilkatsoft.com.

If this method fails, the reason may be present in the InitializeFailCode and InitializeFailReason properties (assuming the failure occurred when trying to open the SFTP session channel).

Returns 1 for success, 0 for failure.

top
InitializeSftpAsync (1)
# returns a CkTask
$ret_task = $sFtp->InitializeSftpAsync();

Creates an asynchronous task to call the InitializeSftp method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
LastReadFailed
# $handle is a string
$retBool = $sFtp->LastReadFailed($handle);

Returns 1 if the last read on the specified handle failed. Otherwise returns 0.

top
LastReadNumBytes
# $handle is a string
$retInt = $sFtp->LastReadNumBytes($handle);

Returns the number of bytes received by the last read on a specified channel.

top
OpenDir
# $path is a string
# $outStr is a CkString (output)
$status = $sFtp->OpenDir($path, $outStr);
$retStr = $sFtp->openDir($path);

Opens a directory for reading. To get a directory listing, first open the directory by calling this method, then call ReadDir to read the directory, and finally call CloseHandle to close the directory.

The SFTP protocol represents file names as strings. File names are assumed to use the slash ('/') character as a directory separator.

File names starting with a slash are "absolute", and are relative to the root of the file system. Names starting with any other character are relative to the user's default directory (home directory). Note that identifying the user is assumed to take place outside of this protocol.

Servers SHOULD interpret a path name component ".." as referring to the parent directory, and "." as referring to the current directory.

An empty path name is valid, and it refers to the user's default directory (usually the user's home directory).

Please note: This method does NOT "change" the remote working directory. It is only a method for opening a directory for the purpose of reading the directory listing.

SFTP is Secure File Transfer over SSH. It is not the FTP protocol. There is no similarity or relationship between FTP and SFTP. Therefore, concepts such as "current remote directory" that exist in FTP do not exist with SFTP. With the SFTP protocol, the current directory will always be the home directory of the user account used during SSH/SFTP authentication. You may pass relative or absolute directory/file paths. A relative path is always relative to the home directory of the SSH user account.

Returns 1 for success, 0 for failure.

More Information and Examples
top
OpenDirAsync (1)
# returns a CkTask
# $path is a string
$ret_task = $sFtp->OpenDirAsync($path);

Creates an asynchronous task to call the OpenDir method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
OpenFile
# $remotePath is a string
# $access is a string
# $createDisposition is a string
# $outStr is a CkString (output)
$status = $sFtp->OpenFile($remotePath, $access, $createDisposition, $outStr);
$retStr = $sFtp->openFile($remotePath, $access, $createDisposition);

Opens or creates a file on the remote system. Returns a handle which may be passed to methods for reading and/or writing the file. The remotePath is the remote file path (the path to the file on the server). When the application is finished with the handle, it should call CloseHandle(remotePath).

access should be one of the following strings: "readOnly", "writeOnly", or "readWrite".

createDisposition is a comma-separated list of keywords to provide more control over how the file is opened or created. One of the following keywords must be present: "createNew", "createTruncate", "openExisting", "openOrCreate", or "truncateExisting". All other keywords are optional. The list of keywords and their meanings are shown here:

createNew
A new file is created; if the file already exists the method fails.

createTruncate
A new file is created; if the file already exists, it is opened and truncated.

openExisting
An existing file is opened. If the file does not exist the method fails.

openOrCreate
If the file exists, it is opened. If the file does not exist, it is created.

truncateExisting
An existing file is opened and truncated. If the file does not exist the method fails.

appendData
Data is always written at the end of the file. Data is not required to be appended atomically. This means that if multiple writers attempt to append data simultaneously, data from the first may be lost.

appendDataAtomic
Data is always written at the end of the file. Data MUST be written atomically so that there is no chance that multiple appenders can collide and result in data being lost.

textMode
Indicates that the server should treat the file as text and convert it to the canonical newline convention in use. When a file is opened with this flag, data is always appended to the end of the file. Servers MUST process multiple, parallel reads and writes correctly in this mode.

blockRead
The server MUST guarantee that no other handle has been opened with read access, and that no other handle will be opened with read access until the client closes the handle. (This MUST apply both to other clients and to other processes on the server.) In a nutshell, this opens the file in non-sharing mode.

blockWrite
The server MUST guarantee that no other handle has been opened with write access, and that no other handle will be opened with write access until the client closes the handle. (This MUST apply both to other clients and to other processes on the server.) In a nutshell, this opens the file in non-sharing mode.

blockDelete
The server MUST guarantee that the file itself is not deleted in any other way until the client closes the handle. No other client or process is allowed to open the file with delete access.

blockAdvisory
If set, the above "block" modes are advisory. In advisory mode, only other accesses that specify a "block" mode need be considered when determining whether the "block" can be granted, and the server need not prevent I/O operations that violate the block mode. The server MAY perform mandatory locking even if the blockAdvisory flag is set.

noFollow
If the final component of the path is a symlink, then the open MUST fail.

deleteOnClose
The file should be deleted when the last handle to it is closed. (The last handle may not be an sftp-handle.) This MAY be emulated by a server if the OS doesn't support it by deleting the file when this handle is closed.

accessAuditAlarmInfo
The client wishes the server to enable any privileges or extra capabilities that the user may have in to allow the reading and writing of AUDIT or ALARM access control entries.

accessBackup
The client wishes the server to enable any privileges or extra capabilities that the user may have in order to bypass normal access checks for the purpose of backing up or restoring files.

backupStream
This flag indicates that the client wishes to read or write a backup stream. A backup stream is a system dependent structured data stream that encodes all the information that must be preserved in order to restore the file from backup medium. The only well defined use for backup stream data read in this fashion is to write it to the same server to a file also opened using the backupStream flag. However, if the server has a well defined backup stream format, there may be other uses for this data outside the scope of this protocol.

IMPORANT: If remotePath is a filename with no path, such as "test.txt", and the server responds with a "Folder not found" error, then try prepending "./" to the remotePath. For example, instead of passing "test.txt", try "./test.txt".

Returns 1 for success, 0 for failure.

top
OpenFileAsync (1)
# returns a CkTask
# $remotePath is a string
# $access is a string
# $createDisposition is a string
$ret_task = $sFtp->OpenFileAsync($remotePath, $access, $createDisposition);

Creates an asynchronous task to call the OpenFile method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
ReadDir
# returns a CkSFtpDir
# $handle is a string
$ret_sFtpDir = $sFtp->ReadDir($handle);

Reads the contents of a directory and returns the directory listing (as an object). The handle returned by OpenDir should be passed to this method.

Returns null on failure

top
ReadDirAsync (1) (2)
# returns a CkTask
# $handle is a string
$ret_task = $sFtp->ReadDirAsync($handle);

Creates an asynchronous task to call the ReadDir method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
ReadFileBytes
# $handle is a string
# $numBytes is an integer
# $outBytes is a CkByteData (output)
$status = $sFtp->ReadFileBytes($handle, $numBytes, $outData);

Reads file data from a remote file on the SSH server. The handle is a file handle returned by the OpenFile method. The numBytes is the maximum number of bytes to read. If the end-of-file is reached prior to reading the number of requested bytes, then fewer bytes may be returned.

To read an entire file, one may call ReadFileBytes repeatedly until Eof(handle) returns 1.

Returns 1 for success, 0 for failure.

top
ReadFileBytesAsync (1)
# returns a CkTask
# $handle is a string
# $numBytes is an integer
$ret_task = $sFtp->ReadFileBytesAsync($handle, $numBytes);

Creates an asynchronous task to call the ReadFileBytes method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
ReadFileBytes32
# $handle is a string
# $offset is an integer
# $numBytes is an integer
# $outBytes is a CkByteData (output)
$status = $sFtp->ReadFileBytes32($handle, $offset, $numBytes, $outData);

Reads file data from a remote file on the SSH server. The handle is a file handle returned by the OpenFile method. The offset is measured in bytes relative to the beginning of the file. (64-bit offsets are supported via the ReadFileBytes64 and ReadFileBytes64s methods.) The offset is ignored if the "textMode" flag was specified during the OpenFile. The numBytes is the maximum number of bytes to read. If the end-of-file is reached prior to reading the number of requested bytes, then fewer bytes may be returned.

Returns 1 for success, 0 for failure.

top
ReadFileBytes64
# $handle is a string
# $offset is a 64-bit integer
# $numBytes is an integer
# $outBytes is a CkByteData (output)
$status = $sFtp->ReadFileBytes64($handle, $offset, $numBytes, $outData);

Reads file data from a remote file on the SSH server. The handle is a file handle returned by the OpenFile method. The offset is a 64-bit integer measured in bytes relative to the beginning of the file. The offset is ignored if the "textMode" flag was specified during the OpenFile. The numBytes is the maximum number of bytes to read. If the end-of-file is reached prior to reading the number of requested bytes, then fewer bytes may be returned.

Returns 1 for success, 0 for failure.

top
ReadFileBytes64s
# $handle is a string
# $offset is a string
# $numBytes is an integer
# $outBytes is a CkByteData (output)
$status = $sFtp->ReadFileBytes64s($handle, $offset, $numBytes, $outData);

(This method exists for systems that do not support 64-bit integers. The 64-bit integer offset is passed as a decimal string instead.)

Reads file data from a remote file on the SSH server. The handle is a file handle returned by the OpenFile method. The offset is a 64-bit integer represented as a decimal string. It represents an offset in bytes from the beginning of the file. The offset is ignored if the "textMode" flag was specified during the OpenFile. The numBytes is the maximum number of bytes to read. If the end-of-file is reached prior to reading the number of requested bytes, then fewer bytes may be returned.

Returns 1 for success, 0 for failure.

top
ReadFileText
# $handle is a string
# $numBytes is an integer
# $charset is a string
# $outStr is a CkString (output)
$status = $sFtp->ReadFileText($handle, $numBytes, $charset, $outStr);
$retStr = $sFtp->readFileText($handle, $numBytes, $charset);

This method is identical to ReadFileBytes except for one thing: The bytes are interpreted according to the specified charset (i.e. the character encoding) and returned as a string. A list of supported charset values may be found on this page: Supported Charsets.

Note: If the charset is an encoding where a single character might be represented in multiple bytes (such as utf-8, Shift_JIS, etc.) then there is a risk that the very last character may be partially read. This is because the method specifies the number of bytes to read, not the number of characters. This is never a problem with character encodings that use a single byte per character, such as all of the iso-8859-* encodings, or the Windows-* encodings.

To read an entire file, one may call ReadFileText repeatedly until Eof(handle) returns 1.

Returns 1 for success, 0 for failure.

top
ReadFileTextAsync (1)
# returns a CkTask
# $handle is a string
# $numBytes is an integer
# $charset is a string
$ret_task = $sFtp->ReadFileTextAsync($handle, $numBytes, $charset);

Creates an asynchronous task to call the ReadFileText method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
ReadFileText32
# $handle is a string
# $offset is an integer
# $numBytes is an integer
# $charset is a string
# $outStr is a CkString (output)
$status = $sFtp->ReadFileText32($handle, $offset, $numBytes, $charset, $outStr);
$retStr = $sFtp->readFileText32($handle, $offset, $numBytes, $charset);

This method is identical to ReadFileBytes32 except for one thing: The bytes are interpreted according to the specified charset (i.e. the character encoding) and returned as a string. A list of supported charset values may be found on this page: Supported Charsets.

Note: If the charset is an encoding where a single character might be represented in multiple bytes (such as utf-8, Shift_JIS, etc.) then there is a risk that the very last character may be partially read. This is because the method specifies the number of bytes to read, not the number of characters. This is never a problem with character encodings that use a single byte per character, such as all of the iso-8859-* encodings, or the Windows-* encodings.

Returns 1 for success, 0 for failure.

top
ReadFileText64
# $handle is a string
# $offset is a 64-bit integer
# $numBytes is an integer
# $charset is a string
# $outStr is a CkString (output)
$status = $sFtp->ReadFileText64($handle, $offset, $numBytes, $charset, $outStr);
$retStr = $sFtp->readFileText64($handle, $offset, $numBytes, $charset);

This method is identical to ReadFileBytes64 except for one thing: The bytes are interpreted according to the specified charset (i.e. the character encoding) and returned as a string. A list of supported charset values may be found on this page: Supported Charsets.

Note: If the charset is an encoding where a single character might be represented in multiple bytes (such as utf-8, Shift_JIS, etc.) then there is a risk that the very last character may be partially read. This is because the method specifies the number of bytes to read, not the number of characters. This is never a problem with character encodings that use a single byte per character, such as all of the iso-8859-* encodings, or the Windows-* encodings.

Returns 1 for success, 0 for failure.

top
ReadFileText64s
# $handle is a string
# $offset is a string
# $numBytes is an integer
# $charset is a string
# $outStr is a CkString (output)
$status = $sFtp->ReadFileText64s($handle, $offset, $numBytes, $charset, $outStr);
$retStr = $sFtp->readFileText64s($handle, $offset, $numBytes, $charset);

This method is identical to ReadFileBytes64s except for one thing: The bytes are interpreted according to the specified charset (i.e. the character encoding) and returned as a string. A list of supported charset values may be found on this page: Supported Charsets.

Note: If the charset is an encoding where a single character might be represented in multiple bytes (such as utf-8, Shift_JIS, etc.) then there is a risk that the very last character may be partially read. This is because the method specifies the number of bytes to read, not the number of characters. This is never a problem with character encodings that use a single byte per character, such as all of the iso-8859-* encodings, or the Windows-* encodings.

Returns 1 for success, 0 for failure.

top
ReadLink
# $path is a string
# $outStr is a CkString (output)
$status = $sFtp->ReadLink($path, $outStr);
$retStr = $sFtp->readLink($path);
Introduced in version 9.5.0.71

Returns the target of a symbolic link on the server. The path is the path of the symbolic link on the server.

Returns 1 for success, 0 for failure.

top
ReadLinkAsync (1)
# returns a CkTask
# $path is a string
$ret_task = $sFtp->ReadLinkAsync($path);
Introduced in version 9.5.0.71

Creates an asynchronous task to call the ReadLink method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
RealPath
# $originalPath is a string
# $composePath is a string
# $outStr is a CkString (output)
$status = $sFtp->RealPath($originalPath, $composePath, $outStr);
$retStr = $sFtp->realPath($originalPath, $composePath);

This method can be used to have the server canonicalize any given path name to an absolute path. This is useful for converting path names containing ".." components or relative pathnames without a leading slash into absolute paths. The absolute path is returned by this method.

originalPath is the first component of the path which the client wishes resolved into a absolute canonical path. This may be the entire path.

The composePath is a path which the client wishes the server to compose with the original path to form the new path. This field is optional and may be set to a zero-length string.

The server will take the originalPath and apply the composePath as a modification to it. composePath may be relative to originalPath or may be an absolute path, in which case originalPath will be discarded. The composePath may be zero length.

Note: Servers running SFTP v4 and below do not support composePath.

Returns 1 for success, 0 for failure.

top
RealPathAsync (1)
# returns a CkTask
# $originalPath is a string
# $composePath is a string
$ret_task = $sFtp->RealPathAsync($originalPath, $composePath);

Creates an asynchronous task to call the RealPath method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
RemoveDir
# $path is a string
$status = $sFtp->RemoveDir($path);

Deletes a directory on the remote server. Most (if not all) SFTP servers require that the directorybe empty of files before it may be deleted.

Returns 1 for success, 0 for failure.

top
RemoveDirAsync (1)
# returns a CkTask
# $path is a string
$ret_task = $sFtp->RemoveDirAsync($path);

Creates an asynchronous task to call the RemoveDir method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
RemoveFile
# $filename is a string
$status = $sFtp->RemoveFile($filename);

Deletes a file on the SFTP server.

Returns 1 for success, 0 for failure.

More Information and Examples
top
RemoveFileAsync (1)
# returns a CkTask
# $filename is a string
$ret_task = $sFtp->RemoveFileAsync($filename);

Creates an asynchronous task to call the RemoveFile method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
RenameFileOrDir
# $oldPath is a string
# $newPath is a string
$status = $sFtp->RenameFileOrDir($oldPath, $newPath);

Renames a file or directory on the SFTP server.

Returns 1 for success, 0 for failure.

top
RenameFileOrDirAsync (1)
# returns a CkTask
# $oldPath is a string
# $newPath is a string
$ret_task = $sFtp->RenameFileOrDirAsync($oldPath, $newPath);

Creates an asynchronous task to call the RenameFileOrDir method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
ResumeDownloadFileByName
# $remoteFilePath is a string
# $localFilePath is a string
$status = $sFtp->ResumeDownloadFileByName($remoteFilePath, $localFilePath);

Resumes an SFTP download. The size of the localFilePath is checked and the download begins at the appropriate position in the remoteFilePath. If localFilePath is empty or non-existent, then this method is identical to DownloadFileByName. If the localFilePath is already fully downloaded, then no additional data is downloaded and the method will return 1.

Returns 1 for success, 0 for failure.

More Information and Examples
top
ResumeDownloadFileByNameAsync (1)
# returns a CkTask
# $remoteFilePath is a string
# $localFilePath is a string
$ret_task = $sFtp->ResumeDownloadFileByNameAsync($remoteFilePath, $localFilePath);

Creates an asynchronous task to call the ResumeDownloadFileByName method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
ResumeUploadFileByName
# $remoteFilePath is a string
# $localFilePath is a string
$status = $sFtp->ResumeUploadFileByName($remoteFilePath, $localFilePath);

Resumes a file upload to the SFTP/SSH server. The size of the remoteFilePath is first checked to determine the starting offset for the upload. If remoteFilePath is empty or does not exist, this method is equivalent to UploadFileByName. If remoteFilePath is already fully uploaded (i.e. it's size is equal to localFilePath), then no additional bytes are uploaded and 1 is returned.

Returns 1 for success, 0 for failure.

More Information and Examples
top
ResumeUploadFileByNameAsync (1)
# returns a CkTask
# $remoteFilePath is a string
# $localFilePath is a string
$ret_task = $sFtp->ResumeUploadFileByNameAsync($remoteFilePath, $localFilePath);

Creates an asynchronous task to call the ResumeUploadFileByName method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
SaveLastError
# $path is a string
$status = $sFtp->SaveLastError($path);

Saves the last-error information (the contents of LastErrorXml) to an XML formatted file.

Returns 1 for success, 0 for failure.

top
SendIgnore
$status = $sFtp->SendIgnore();
Introduced in version 9.5.0.66

Sends an IGNORE message to the SSH server. This is one way of verifying that the connection to the SSH server is open and valid. The SSH server does not respond to an IGNORE message. It simply ignores it. IGNORE messages are not associated with a channel (i.e., you do not need to first open a channel prior to sending an IGNORE message).

Returns 1 for success, 0 for failure.

top
SendIgnoreAsync (1)
# returns a CkTask
$ret_task = $sFtp->SendIgnoreAsync();
Introduced in version 9.5.0.66

Creates an asynchronous task to call the SendIgnore method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
SetCreateDt
# $pathOrHandle is a string
# $isHandle is a boolean
# $createDateTime is a CkDateTime
$status = $sFtp->SetCreateDt($pathOrHandle, $isHandle, $createDateTime);

Sets the create date/time for a file on the server. The pathOrHandle may be a filepath or the handle of a currently open file. isHandle should be set to 1 if the pathOrHandle is a handle, otherwise set isHandle to 0.

Note: Servers running version 3 or lower of the SFTP protocol do not support setting the create date/time.

Returns 1 for success, 0 for failure.

top
SetCreateDtAsync (1)
# returns a CkTask
# $pathOrHandle is a string
# $isHandle is a boolean
# $createDateTime is a CkDateTime
$ret_task = $sFtp->SetCreateDtAsync($pathOrHandle, $isHandle, $createDateTime);

Creates an asynchronous task to call the SetCreateDt method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
SetCreateTimeStr
# $pathOrHandle is a string
# $bIsHandle is a boolean
# $dateTimeStr is a string
$status = $sFtp->SetCreateTimeStr($pathOrHandle, $bIsHandle, $dateTimeStr);

The same as SetCreateTime, except the date/time is passed as an RFC822 formatted string.

Returns 1 for success, 0 for failure.

top
SetCreateTimeStrAsync (1)
# returns a CkTask
# $pathOrHandle is a string
# $bIsHandle is a boolean
# $dateTimeStr is a string
$ret_task = $sFtp->SetCreateTimeStrAsync($pathOrHandle, $bIsHandle, $dateTimeStr);

Creates an asynchronous task to call the SetCreateTimeStr method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
SetLastAccessDt
# $pathOrHandle is a string
# $isHandle is a boolean
# $accessDateTime is a CkDateTime
$status = $sFtp->SetLastAccessDt($pathOrHandle, $isHandle, $accessDateTime);

Sets the last-access date/time for a file on the server. The pathOrHandle may be a filepath or the handle of a currently open file. isHandle should be set to 1 if the pathOrHandle is a handle, otherwise set isHandle to 0.

Returns 1 for success, 0 for failure.

top
SetLastAccessDtAsync (1)
# returns a CkTask
# $pathOrHandle is a string
# $isHandle is a boolean
# $accessDateTime is a CkDateTime
$ret_task = $sFtp->SetLastAccessDtAsync($pathOrHandle, $isHandle, $accessDateTime);

Creates an asynchronous task to call the SetLastAccessDt method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
SetLastAccessTimeStr
# $pathOrHandle is a string
# $bIsHandle is a boolean
# $dateTimeStr is a string
$status = $sFtp->SetLastAccessTimeStr($pathOrHandle, $bIsHandle, $dateTimeStr);

The same as SetLastAccessTime, except the date/time is passed as an RFC822 formatted string.

Returns 1 for success, 0 for failure.

top
SetLastAccessTimeStrAsync (1)
# returns a CkTask
# $pathOrHandle is a string
# $bIsHandle is a boolean
# $dateTimeStr is a string
$ret_task = $sFtp->SetLastAccessTimeStrAsync($pathOrHandle, $bIsHandle, $dateTimeStr);

Creates an asynchronous task to call the SetLastAccessTimeStr method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
SetLastModifiedDt
# $pathOrHandle is a string
# $isHandle is a boolean
# $modifiedDateTime is a CkDateTime
$status = $sFtp->SetLastModifiedDt($pathOrHandle, $isHandle, $modifiedDateTime);

Sets the last-modified date/time for a file on the server. The pathOrHandle may be a filepath or the handle of a currently open file. isHandle should be set to 1 if the pathOrHandle is a handle, otherwise set isHandle to 0.

Returns 1 for success, 0 for failure.

top
SetLastModifiedDtAsync (1)
# returns a CkTask
# $pathOrHandle is a string
# $isHandle is a boolean
# $modifiedDateTime is a CkDateTime
$ret_task = $sFtp->SetLastModifiedDtAsync($pathOrHandle, $isHandle, $modifiedDateTime);

Creates an asynchronous task to call the SetLastModifiedDt method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
SetLastModifiedTimeStr
# $pathOrHandle is a string
# $bIsHandle is a boolean
# $dateTimeStr is a string
$status = $sFtp->SetLastModifiedTimeStr($pathOrHandle, $bIsHandle, $dateTimeStr);

The same as SetLastModifiedTime, except the date/time is passed as an RFC822 formatted string.

Returns 1 for success, 0 for failure.

top
SetLastModifiedTimeStrAsync (1)
# returns a CkTask
# $pathOrHandle is a string
# $bIsHandle is a boolean
# $dateTimeStr is a string
$ret_task = $sFtp->SetLastModifiedTimeStrAsync($pathOrHandle, $bIsHandle, $dateTimeStr);

Creates an asynchronous task to call the SetLastModifiedTimeStr method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
SetOwnerAndGroup
# $pathOrHandle is a string
# $isHandle is a boolean
# $owner is a string
# $group is a string
$status = $sFtp->SetOwnerAndGroup($pathOrHandle, $isHandle, $owner, $group);

Sets the owner and group for a file on the server. The pathOrHandle may be a filepath or the handle of a currently open file. isHandle should be set to 1 if the pathOrHandle is a handle, otherwise set isHandle to 0.

Note: Servers running version 3 or lower of the SFTP protocol do not support setting the owner and group.

Returns 1 for success, 0 for failure.

top
SetOwnerAndGroupAsync (1)
# returns a CkTask
# $pathOrHandle is a string
# $isHandle is a boolean
# $owner is a string
# $group is a string
$ret_task = $sFtp->SetOwnerAndGroupAsync($pathOrHandle, $isHandle, $owner, $group);

Creates an asynchronous task to call the SetOwnerAndGroup method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
SetPermissions
# $pathOrHandle is a string
# $isHandle is a boolean
# $permissions is an integer
$status = $sFtp->SetPermissions($pathOrHandle, $isHandle, $permissions);

Sets the permissions for a file on the server. The pathOrHandle may be a filepath or the handle of a currently open file. isHandle should be set to 1 if the pathOrHandle is a handle, otherwise set isHandle to 0.

Returns 1 for success, 0 for failure.

top
SetPermissionsAsync (1)
# returns a CkTask
# $pathOrHandle is a string
# $isHandle is a boolean
# $permissions is an integer
$ret_task = $sFtp->SetPermissionsAsync($pathOrHandle, $isHandle, $permissions);

Creates an asynchronous task to call the SetPermissions method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
SymLink
# $oldPath is a string
# $newPath is a string
$status = $sFtp->SymLink($oldPath, $newPath);
Introduced in version 9.5.0.71

Create a symbolic link from oldpath to newpath on the server filesystem.

Returns 1 for success, 0 for failure.

More Information and Examples
top
SymLinkAsync (1)
# returns a CkTask
# $oldPath is a string
# $newPath is a string
$ret_task = $sFtp->SymLinkAsync($oldPath, $newPath);
Introduced in version 9.5.0.71

Creates an asynchronous task to call the SymLink method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
SyncTreeDownload
# $remoteRoot is a string
# $localRoot is a string
# $mode is an integer
# $recurse is a boolean
$status = $sFtp->SyncTreeDownload($remoteRoot, $localRoot, $mode, $recurse);

Downloads files from the SFTP server to a local directory tree. Synchronization modes include:

mode=0: Download all files
mode=1: Download all files that do not exist on the local filesystem.
mode=2: Download newer or non-existant files.
mode=3: Download only newer files. If a file does not already exist on the local filesystem, it is not downloaded from the server.
mode=5: Download only missing files or files with size differences.
mode=6: Same as mode 5, but also download newer files.
mode=99: Do not download files, but instead delete remote files that do not exist locally.

If recurse is 0, then the remotel directory tree is not recursively descended.

Returns 1 for success, 0 for failure.

top
SyncTreeDownloadAsync (1)
# returns a CkTask
# $remoteRoot is a string
# $localRoot is a string
# $mode is an integer
# $recurse is a boolean
$ret_task = $sFtp->SyncTreeDownloadAsync($remoteRoot, $localRoot, $mode, $recurse);

Creates an asynchronous task to call the SyncTreeDownload method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
SyncTreeUpload
# $localBaseDir is a string
# $remoteBaseDir is a string
# $mode is an integer
# $bRecurse is a boolean
$status = $sFtp->SyncTreeUpload($localBaseDir, $remoteBaseDir, $mode, $bRecurse);

Uploads a directory tree from the local filesystem to the SFTP server. Synchronization modes include:

mode=0: Upload all files
mode=1: Upload all files that do not exist on the server.
mode=2: Upload newer or non-existant files.
mode=3: Upload only newer files. If a file does not already exist on the server, it is not uploaded.
mode=4: transfer missing files or files with size differences.
mode=5: same as mode 4, but also newer files.

If bRecurse is 0, then the local directory tree is not recursively descended.

Returns 1 for success, 0 for failure.

More Information and Examples
top
SyncTreeUploadAsync (1)
# returns a CkTask
# $localBaseDir is a string
# $remoteBaseDir is a string
# $mode is an integer
# $bRecurse is a boolean
$ret_task = $sFtp->SyncTreeUploadAsync($localBaseDir, $remoteBaseDir, $mode, $bRecurse);

Creates an asynchronous task to call the SyncTreeUpload method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
UnlockComponent
# $unlockCode is a string
$status = $sFtp->UnlockComponent($unlockCode);

Unlocks the component. This must be called once prior to calling any other method. A fully-functional 30-day trial is automatically started when an arbitrary string is passed to this method. For example, passing "Hello", or "abc123" will unlock the component for the 1st thirty days after the initial install.

A purchased unlock code for SFTP should contain the substring ".SS" or "SSH" (or it can be a Bundle unlock code) because SFTP is the Secure File Transfer protocol over SSH. It is a sub-system of the SSH protocol. It is not the FTP protocol. If the Chilkat FTP2 component/library should be used for the FTP protocol.

Returns 1 for success, 0 for failure.

top
UploadBd
# $binData is a CkBinData
# $remoteFilePath is a string
$status = $sFtp->UploadBd($binData, $remoteFilePath);
Introduced in version 9.5.0.62

Uploads the contents of a BinData to a remote file.

Returns 1 for success, 0 for failure.

More Information and Examples
top
UploadBdAsync (1)
# returns a CkTask
# $binData is a CkBinData
# $remoteFilePath is a string
$ret_task = $sFtp->UploadBdAsync($binData, $remoteFilePath);
Introduced in version 9.5.0.62

Creates an asynchronous task to call the UploadBd method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
UploadFile
# $handle is a string
# $fromFilename is a string
$status = $sFtp->UploadFile($handle, $fromFilename);

Uploads a file from the local filesystem to the SFTP server. handle is a handle of a currently open file (obtained by calling the OpenFile method). fromFilename is the local file path of the file to be uploaded.

Returns 1 for success, 0 for failure.

top
UploadFileAsync (1)
# returns a CkTask
# $handle is a string
# $fromFilename is a string
$ret_task = $sFtp->UploadFileAsync($handle, $fromFilename);

Creates an asynchronous task to call the UploadFile method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
UploadFileByName
# $remoteFilePath is a string
# $localFilePath is a string
$status = $sFtp->UploadFileByName($remoteFilePath, $localFilePath);

Simplified method for uploading a file to the SFTP/SSH server.

The last-modified date/time is only preserved if the PreserveDate property is set to 1. This behavior of maintaining the last-mod date/time was introduced in v9.5.0.40.

Returns 1 for success, 0 for failure.

top
UploadFileByNameAsync (1)
# returns a CkTask
# $remoteFilePath is a string
# $localFilePath is a string
$ret_task = $sFtp->UploadFileByNameAsync($remoteFilePath, $localFilePath);

Creates an asynchronous task to call the UploadFileByName method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
UploadSb
# $sb is a CkStringBuilder
# $remoteFilePath is a string
# $charset is a string
# $includeBom is a boolean
$status = $sFtp->UploadSb($sb, $remoteFilePath, $charset, $includeBom);
Introduced in version 9.5.0.62

Uploads the contents of a StringBuilder to a remote file.

Returns 1 for success, 0 for failure.

top
UploadSbAsync (1)
# returns a CkTask
# $sb is a CkStringBuilder
# $remoteFilePath is a string
# $charset is a string
# $includeBom is a boolean
$ret_task = $sFtp->UploadSbAsync($sb, $remoteFilePath, $charset, $includeBom);
Introduced in version 9.5.0.62

Creates an asynchronous task to call the UploadSb method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
WriteFileBytes
# $handle is a string
# $byteData is a CkByteData
$status = $sFtp->WriteFileBytes($handle, $byteData);

Appends byte data to an open file. The handle is a file handle returned by the OpenFile method.

Returns 1 for success, 0 for failure.

top
WriteFileBytesAsync (1)
# returns a CkTask
# $handle is a string
# $byteData is a CkByteData
$ret_task = $sFtp->WriteFileBytesAsync($handle, $byteData);

Creates an asynchronous task to call the WriteFileBytes method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
WriteFileBytes32
# $handle is a string
# $offset is an integer
# $data is a CkByteData
$status = $sFtp->WriteFileBytes32($handle, $offset, $data);

Writes data to an open file at a specific offset from the beginning of the file. The handle is a file handle returned by the OpenFile method. The offset is an offset from the beginning of the file.

Returns 1 for success, 0 for failure.

top
WriteFileBytes64
# $handle is a string
# $offset64 is a 64-bit integer
# $data is a CkByteData
$status = $sFtp->WriteFileBytes64($handle, $offset64, $data);

Writes data to an open file at a specific offset from the beginning of the file. The handle is a file handle returned by the OpenFile method. The offset64 is an offset from the beginning of the file.

Returns 1 for success, 0 for failure.

top
WriteFileBytes64s
# $handle is a string
# $offset64 is a string
# $data is a CkByteData
$status = $sFtp->WriteFileBytes64s($handle, $offset64, $data);

Writes data to an open file at a specific offset from the beginning of the file. The handle is a file handle returned by the OpenFile method. The offset64 is an offset (in decimal string format) from the beginning of the file.

Returns 1 for success, 0 for failure.

top
WriteFileText
# $handle is a string
# $charset is a string
# $textData is a string
$status = $sFtp->WriteFileText($handle, $charset, $textData);

Appends character data to an open file. The handle is a file handle returned by the OpenFile method. charset is a character encoding and is typically set to values such as "ansi", "utf-8", "windows-1252", etc. A list of supported character encodings is found on this page: Supported Charsets.

Note: It is necessary to specify the character encoding because in many programming languages, strings are represented as Unicode (2 bytes/char) and in most cases one does not wish to write Unicode chars to a text file (although it is possible by setting charset = "Unicode").

Returns 1 for success, 0 for failure.

top
WriteFileTextAsync (1)
# returns a CkTask
# $handle is a string
# $charset is a string
# $textData is a string
$ret_task = $sFtp->WriteFileTextAsync($handle, $charset, $textData);

Creates an asynchronous task to call the WriteFileText method with the arguments provided. (Async methods are available starting in Chilkat v9.5.0.52.)

Returns null on failure

top
WriteFileText32
# $handle is a string
# $offset32 is an integer
# $charset is a string
# $textData is a string
$status = $sFtp->WriteFileText32($handle, $offset32, $charset, $textData);

Writes character data to an open file at a specific offset from the beginning of the file. The handle is a file handle returned by the OpenFile method. charset is a character encoding and is typically set to values such as "ansi", "utf-8", "windows-1252", etc. A list of supported character encodings is found on this page: Supported Charsets.

Returns 1 for success, 0 for failure.

top
WriteFileText64
# $handle is a string
# $offset64 is a 64-bit integer
# $charset is a string
# $textData is a string
$status = $sFtp->WriteFileText64($handle, $offset64, $charset, $textData);

Writes character data to an open file at a specific offset from the beginning of the file. The handle is a file handle returned by the OpenFile method. charset is a character encoding and is typically set to values such as "ansi", "utf-8", "windows-1252", etc. A list of supported character encodings is found on this page: Supported Charsets.

Returns 1 for success, 0 for failure.

top
WriteFileText64s
# $handle is a string
# $offset64 is a string
# $charset is a string
# $textData is a string
$status = $sFtp->WriteFileText64s($handle, $offset64, $charset, $textData);

Writes character data to an open file at a specific offset from the beginning of the file. The handle is a file handle returned by the OpenFile method. The offset64 is an offset (in decimal string format) from the beginning of the file. charset is a character encoding and is typically set to values such as "ansi", "utf-8", "windows-1252", etc. A list of supported character encodings is found on this page: Supported Charsets.

Returns 1 for success, 0 for failure.

top