---
product: Chilkat
product_version: 11.7.0
language: js
language_label: JavaScript
class: Ftp2
license: bundle
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/jsFtp2Ref.html
---
# Chilkat Ftp2 — JavaScript — v11.7.0

> Chilkat 11.7.0 · language=js · class=Ftp2
> Other versions: replace `11.7.0` in this URL. Other languages: `https://www.chilkatsoft.com/ai-docs/v/11.7.0/<lang>/classes/Ftp2.md`.
> Language-wide rules (install, unlock, error model, strings/bytes): `https://www.chilkatsoft.com/ai-docs/v/11.7.0/js/guide.md`.

## Purpose

Ftp2

**Connect, secure, transfer, synchronize, and manage files on FTP servers.**

`Ftp2` is a comprehensive FTP and FTPS client class for applications that need reliable file transfer and remote file management. It supports connection setup, explicit and implicit TLS, passive and active data connections, uploads, downloads, directory listings, recursive operations, synchronization, proxy traversal, credential protection, and detailed diagnostics.

**FTP and FTPS connections**

Connect using plain FTP, explicit TLS, or implicit TLS, with control over ports, timeouts, passive mode, and IPv4/IPv6 behavior.

**Upload and download files**

Transfer files, text, binary data, streams, and in-memory content, with support for resume, append, and progress monitoring.

**Remote file management**

List directories, create and remove folders, rename files, delete files, inspect sizes and timestamps, and manage remote paths.

**Recursive and sync operations**

Upload or download directory trees, mirror folders, and synchronize local and remote content.

**Security and credentials**

Use TLS options, client certificates, secure password handling, and secret-backed credential references where appropriate.

**Diagnostics and TLS details**

Use `LastErrorText`, session logs, directory listings, and TLS negotiation details to troubleshoot server behavior.

**Protocol note:** `Ftp2` implements FTP and FTP over TLS (FTPS). It does not implement SSH File Transfer Protocol. Use `SFtp` when the server requires SFTP over SSH.

**Stateful session:** One `Ftp2` object represents one FTP session with a current remote directory, transfer type, detected server capabilities, and a cached directory listing. FTP commands and replies use the persistent control connection, while each listing, upload, or download uses a separate data connection.

**Paths and encodings:** Remote paths are interpreted by the FTP server and are normally relative to the current remote directory unless the server recognizes an absolute path. Remote command text uses `CommandCharset`, directory-listing bytes use `DirListingCharset`, and text-transfer methods use their own content charset argument.

**Partial operations:** FTP operations are not transactional. A transfer, recursive operation, deletion, or synchronization can complete some work before a later step fails. Chilkat does not generally roll back completed filesystem or server changes and does not automatically retry or resume a failed transfer unless the application explicitly uses the resume features.

**Server variability:** FTP extensions and server behavior vary. Features such as `MLSD`, `EPSV`, `MODE Z`, checksum commands, timestamp-setting commands, wildcard matching, and rename-overwrite behavior depend on the server. Inspect `LastReply`, LastErrorText, and the session log when behavior differs between servers.

**FTPS certificate verification:** `RequireSslCertVerify` defaults to `false`. Production FTPS clients should normally enable certificate-chain verification and use the expected server hostname. Certificate pinning and certificate requirements are additional checks and do not replace normal trust and hostname validation.

**Tip:** For FTPS troubleshooting, inspect the detailed diagnostic output and, when available, the last JSON data describing the TLS negotiation, certificate validation, protocol version, and related connection details.

For an extended overview, see [Ftp2 Class Overview](https://www.chilkatsoft.com/ftp2_class_overview.asp).

## Object creation, unlocking and error handling

**Object Creation**

Note: This is intended for running within a [Chilkat.Js embedded JavaScript engine](https://www.chilkatsoft.com/chilkat_javascript_engine.asp).

```
var obj = new CkFtp2();
```

Call `Global.UnlockBundle` once at the start of the program, before using this or any other Chilkat class. Any string unlocks a fully functional 30-day trial; a purchased unlock code is used in production. See `guide.md` for the exact code in JavaScript.

How failure is reported depends on the method's return type and is stated in the note under each method below. In every case the diagnostic text is in the `LastErrorText` property of the object whose method was called.

## Members common to every Chilkat class

Documented once per language in `common-members.md`; listed here so this page is self-contained.

| Property | Signature | Access | Meaning |
|---|---|---|---|
| `DebugLogFilePath` | `DebugLogFilePath` | read/write | If set to a file path, this property logs the LastErrorText of each Chilkat method or property call to the specified file. |
| `LastErrorHtml` | `LastErrorHtml` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `LastErrorText` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `LastErrorXml` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `LastMethodSuccess` | read/write | Indicates the success or failure of the most recent method call: `true` means success, `false` means failure. |
| `VerboseLogging` | `VerboseLogging` | read/write | If set to `true`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `Version` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `AbortCurrent` | property, read/write | `AbortCurrent` |
| `Account` | property, read/write | `Account` |
| `ActivePortRangeEnd` | property, read/write | `ActivePortRangeEnd` |
| `ActivePortRangeStart` | property, read/write | `ActivePortRangeStart` |
| `AllocateSize` | property, read/write | `AllocateSize` |
| `AllowMlsd` | property, read/write | `AllowMlsd` |
| `AuthSsl` | property, read/write | `AuthSsl` |
| `AuthTls` | property, read/write | `AuthTls` |
| `AutoFeat` | property, read/write | `AutoFeat` |
| `AutoFix` | property, read/write | `AutoFix` |
| `AutoGetSizeForProgress` | property, read/write | `AutoGetSizeForProgress` |
| `AutoOptsUtf8` | property, read/write | `AutoOptsUtf8` |
| `AutoSetUseEpsv` | property, read/write | `AutoSetUseEpsv` |
| `AutoSyst` | property, read/write | `AutoSyst` |
| `AutoXcrc` | property, read/write | `AutoXcrc` |
| `BandwidthThrottleDown` | property, read/write | `BandwidthThrottleDown` |
| `BandwidthThrottleUp` | property, read/write | `BandwidthThrottleUp` |
| `ClientIpAddress` | property, read/write | `ClientIpAddress` |
| `CommandCharset` | property, read/write | `CommandCharset` |
| `ConnectFailReason` | property, read-only | `ConnectFailReason` |
| `ConnectTimeout` | property, read/write | `ConnectTimeout` |
| `ConnectVerified` | property, read-only | `ConnectVerified` |
| `CrlfMode` | property, read/write | `CrlfMode` |
| `CurBytesReceived` | property, read-only | `CurBytesReceived` |
| `CurBytesReceived64` | property, read-only | `CurBytesReceived64` |
| `CurBytesReceivedStr` | property, read-only | `CurBytesReceivedStr` |
| `CurBytesSent` | property, read-only | `CurBytesSent` |
| `CurBytesSent64` | property, read-only | `CurBytesSent64` |
| `CurBytesSentStr` | property, read-only | `CurBytesSentStr` |
| `DataProtection` | property, read/write | `DataProtection` |
| `DirListingCharset` | property, read/write | `DirListingCharset` |
| `DownloadTransferRate` | property, read-only | `DownloadTransferRate` |
| `EnableSecrets` | property, read/write | `EnableSecrets` |
| `ForcePortIpAddress` | property, read/write | `ForcePortIpAddress` |
| `Greeting` | property, read-only | `Greeting` |
| `HasModeZ` | property, read-only | `HasModeZ` |
| `Hostname` | property, read/write | `Hostname` |
| `HttpProxyAuthMethod` | property, read/write | `HttpProxyAuthMethod` |
| `HttpProxyDomain` | property, read/write | `HttpProxyDomain` |
| `HttpProxyHostname` | property, read/write | `HttpProxyHostname` |
| `HttpProxyPassword` | property, read/write | `HttpProxyPassword` |
| `HttpProxyPort` | property, read/write | `HttpProxyPort` |
| `HttpProxyUsername` | property, read/write | `HttpProxyUsername` |
| `IdleTimeoutMs` | property, read/write | `IdleTimeoutMs` |
| `IsConnected` | property, read-only | `IsConnected` |
| `KeepSessionLog` | property, read/write | `KeepSessionLog` |
| `LargeFileMeasures` | property, read/write | `LargeFileMeasures` |
| `LastReply` | property, read-only | `LastReply` |
| `ListOption` | property, read/write | `ListOption` |
| `ListPattern` | property, read/write | `ListPattern` |
| `LoginVerified` | property, read-only | `LoginVerified` |
| `PartialTransfer` | property, read-only | `PartialTransfer` |
| `Passive` | property, read/write | `Passive` |
| `PassiveUseHostAddr` | property, read/write | `PassiveUseHostAddr` |
| `Password` | property, read/write | `Password` |
| `Port` | property, read/write | `Port` |
| `PreferIpv6` | property, read/write | `PreferIpv6` |
| `PreferNlst` | property, read/write | `PreferNlst` |
| `ProgressMonSize` | property, read/write | `ProgressMonSize` |
| `ProgressMonSize64` | property, read/write | `ProgressMonSize64` |
| `ProxyHostname` | property, read/write | `ProxyHostname` |
| `ProxyMethod` | property, read/write | `ProxyMethod` |
| `ProxyPassword` | property, read/write | `ProxyPassword` |
| `ProxyPort` | property, read/write | `ProxyPort` |
| `ProxyUsername` | property, read/write | `ProxyUsername` |
| `ReadTimeout` | property, read/write | `ReadTimeout` |
| `RequireSslCertVerify` | property, read/write | `RequireSslCertVerify` |
| `RestartNext` | property, read/write | `RestartNext` |
| `SessionLog` | property, read-only | `SessionLog` |
| `SocksHostname` | property, read/write | `SocksHostname` |
| `SocksPassword` | property, read/write | `SocksPassword` |
| `SocksPort` | property, read/write | `SocksPort` |
| `SocksUsername` | property, read/write | `SocksUsername` |
| `SocksVersion` | property, read/write | `SocksVersion` |
| `SoRcvBuf` | property, read/write | `SoRcvBuf` |
| `SoSndBuf` | property, read/write | `SoSndBuf` |
| `Ssl` | property, read/write | `Ssl` |
| `SslAllowedCiphers` | property, read/write | `SslAllowedCiphers` |
| `SslProtocol` | property, read/write | `SslProtocol` |
| `SslServerCertVerified` | property, read-only | `SslServerCertVerified` |
| `SyncCreateAllLocalDirs` | property, read/write | `SyncCreateAllLocalDirs` |
| `SyncMustMatch` | property, read/write | `SyncMustMatch` |
| `SyncMustMatchDir` | property, read/write | `SyncMustMatchDir` |
| `SyncMustNotMatch` | property, read/write | `SyncMustNotMatch` |
| `SyncMustNotMatchDir` | property, read/write | `SyncMustNotMatchDir` |
| `SyncPreview` | property, read-only | `SyncPreview` |
| `TlsCipherSuite` | property, read-only | `TlsCipherSuite` |
| `TlsPinSet` | property, read/write | `TlsPinSet` |
| `TlsVersion` | property, read-only | `TlsVersion` |
| `UncommonOptions` | property, read/write | `UncommonOptions` |
| `UploadTransferRate` | property, read-only | `UploadTransferRate` |
| `UseEpsv` | property, read/write | `UseEpsv` |
| `Username` | property, read/write | `Username` |
| `AppendFile` | method | `var success = AppendFile(localFilePath, remoteFilePath);` |
| `AppendFileBd` | method | `var success = AppendFileBd(remoteFilename, bd);` |
| `AppendFileFromTextData` | method | `var success = AppendFileFromTextData(remoteFilename, textData, charset);` |
| `AppendFileSb` | method | `var success = AppendFileSb(remoteFilename, sb, charset);` |
| `ChangeRemoteDir` | method | `var success = ChangeRemoteDir(remoteDirPath);` |
| `CheckConnection` | method | `var success = CheckConnection();` |
| `ClearControlChannel` | method | `var success = ClearControlChannel();` |
| `ClearDirCache` | method | `ClearDirCache();` |
| `ClearSessionLog` | method | `ClearSessionLog();` |
| `Connect` | method | `var success = Connect();` |
| `ConnectOnly` | method | `var success = ConnectOnly();` |
| `ConvertToTls` | method | `var success = ConvertToTls();` |
| `CreatePlan` | method | `var strVal = CreatePlan(localDir);` |
| `CreateRemoteDir` | method | `var success = CreateRemoteDir(remoteDirPath);` |
| `DeleteMatching` | method | `var intVal = DeleteMatching(remotePattern);` |
| `DeleteRemoteFile` | method | `var success = DeleteRemoteFile(remoteFilePath);` |
| `DeleteTree` | method | `var success = DeleteTree();` |
| `DirTreeXml` | method | `var strVal = DirTreeXml();` |
| `Disconnect` | method | `var success = Disconnect();` |
| `DownloadTree` | method | `var success = DownloadTree(localRoot);` |
| `Feat` | method | `var strVal = Feat();` |
| `GetCreateTimeByNameStr` | method | `var strVal = GetCreateTimeByNameStr(filename);` |
| `GetCreateTimeStr` | method | `var strVal = GetCreateTimeStr(index);` |
| `GetCurrentRemoteDir` | method | `var strVal = GetCurrentRemoteDir();` |
| `GetDirCount` | method | `var intVal = GetDirCount();` |
| `GetFile` | method | `var success = GetFile(remoteFilePath, localFilePath);` |
| `GetFileBd` | method | `var success = GetFileBd(remoteFilePath, binData);` |
| `GetFilename` | method | `var strVal = GetFilename(index);` |
| `GetFileSb` | method | `var success = GetFileSb(remoteFilePath, charset, sb);` |
| `GetGroup` | method | `var strVal = GetGroup(index);` |
| `GetIsDirectory` | method | `var boolVal = GetIsDirectory(index);` |
| `GetIsSymbolicLink` | method | `var boolVal = GetIsSymbolicLink(index);` |
| `GetLastJsonData` | method | `GetLastJsonData(json);` |
| `GetLastModifiedTimeByNameStr` | method | `var strVal = GetLastModifiedTimeByNameStr(filename);` |
| `GetLastModifiedTimeStr` | method | `var strVal = GetLastModifiedTimeStr(index);` |
| `GetOwner` | method | `var strVal = GetOwner(index);` |
| `GetPermissions` | method | `var strVal = GetPermissions(index);` |
| `GetPermType` | method | `var strVal = GetPermType(index);` |
| `GetRemoteFileTextC` | method | `var strVal = GetRemoteFileTextC(remoteFilename, charset);` |
| `GetRemoteFileTextData` | method | `var strVal = GetRemoteFileTextData(remoteFilename);` |
| `GetServerCert` | method | `var success = GetServerCert(cert);` |
| `GetSize` | method | `var intVal = GetSize(index);` |
| `GetSize64` | method | `var int64val = GetSize64(index);` |
| `GetSizeByName` | method | `var intVal = GetSizeByName(filename);` |
| `GetSizeByName64` | method | `var int64val = GetSizeByName64(filename);` |
| `GetSizeStr` | method | `var strVal = GetSizeStr(index);` |
| `GetSizeStrByName` | method | `var strVal = GetSizeStrByName(filename);` |
| `GetSyncedFiles` | method | `GetSyncedFiles(strTable);` |
| `GetTextDirListing` | method | `var strVal = GetTextDirListing(pattern);` |
| `GetXmlDirListing` | method | `var strVal = GetXmlDirListing(pattern);` |
| `LargeFileUpload` | method | `var success = LargeFileUpload(localPath, remotePath, chunkSize);` |
| `LoginAfterConnectOnly` | method | `var success = LoginAfterConnectOnly();` |
| `MGetFiles` | method | `var intVal = MGetFiles(remotePattern, localDir);` |
| `MPutFiles` | method | `var intVal = MPutFiles(pattern);` |
| `NlstXml` | method | `var strVal = NlstXml(remoteDirPattern);` |
| `Noop` | method | `var success = Noop();` |
| `PutFile` | method | `var success = PutFile(localFilePath, remoteFilePath);` |
| `PutFileBd` | method | `var success = PutFileBd(binData, remoteFilePath);` |
| `PutFileFromTextData` | method | `var success = PutFileFromTextData(remoteFilename, textData, charset);` |
| `PutFileSb` | method | `var success = PutFileSb(sb, charset, includeBom, remoteFilePath);` |
| `PutPlan` | method | `var success = PutPlan(plan, alreadyDoneFilename);` |
| `PutTree` | method | `var success = PutTree(localDir);` |
| `Quote` | method | `var success = Quote(cmd);` |
| `RemoveRemoteDir` | method | `var success = RemoveRemoteDir(remoteDirPath);` |
| `RenameRemoteFile` | method | `var success = RenameRemoteFile(existingRemoteFilePath, newRemoteFilePath);` |
| `SendCommand` | method | `var strVal = SendCommand(cmd);` |
| `SetModeZ` | method | `var success = SetModeZ();` |
| `SetOldestDateStr` | method | `SetOldestDateStr(oldestDateTimeStr);` |
| `SetOption` | method | `var success = SetOption(optionName);` |
| `SetRemoteFileDateTimeStr` | method | `var success = SetRemoteFileDateTimeStr(dateTimeStr, remoteFilename);` |
| `SetRemoteFileDt` | method | `var success = SetRemoteFileDt(dt, remoteFilename);` |
| `SetSecurePassword` | method | `var success = SetSecurePassword(password);` |
| `SetSslCertRequirement` | method | `SetSslCertRequirement(reqName, reqValue);` |
| `SetSslClientCert` | method | `var success = SetSslClientCert(cert);` |
| `SetSslClientCertPem` | method | `var success = SetSslClientCertPem(pemDataOrFilename, pemPassword);` |
| `SetSslClientCertPfx` | method | `var success = SetSslClientCertPfx(pfxFilename, pfxPassword);` |
| `SetTypeAscii` | method | `var success = SetTypeAscii();` |
| `SetTypeBinary` | method | `var success = SetTypeBinary();` |
| `Site` | method | `var success = Site(siteCommand);` |
| `SleepMs` | method | `SleepMs(millisec);` |
| `Stat` | method | `var strVal = Stat();` |
| `SyncDeleteRemote` | method | `var success = SyncDeleteRemote(localRoot);` |
| `SyncLocalDir` | method | `var success = SyncLocalDir(localRoot, mode);` |
| `SyncLocalTree` | method | `var success = SyncLocalTree(localRoot, mode);` |
| `SyncRemoteTree` | method | `var success = SyncRemoteTree(localRoot, mode);` |
| `SyncRemoteTree2` | method | `var success = SyncRemoteTree2(localDirPath, mode, bDescend, bPreviewOnly);` |
| `Syst` | method | `var strVal = Syst();` |

## Properties

### Ftp2.AbortCurrent

`Chilkat 11.7.0 · js · Ftp2 · AbortCurrent · property · read/write · since 9.5.0.58`

```javascript
AbortCurrent
```

· `boolean`

Set to `true` to request cancellation of the operation currently running on this object. Long-running network and file-transfer methods periodically check this property; methods that complete quickly may finish before the request is observed.

A synchronous call can be cancelled from another thread by setting this property on the same object. The property is reset to `false` after cancellation is processed, and a stale request is cleared when a later method begins.

**Cancellation behavior:** Treat this as a cancellation request, not a guarantee of immediate termination. Use the method's normal return value and diagnostic properties to determine the outcome.

### Ftp2.Account

`Chilkat 11.7.0 · js · Ftp2 · Account · property · read/write`

```javascript
Account
```

· `string`

**Very rarely needed today:** Almost all modern FTP servers rely exclusively on the `USER` and `PASS` commands for authentication and access control.

The `ACCT` command is a legacy feature from early computing systems that sometimes required a separate account code for billing or resource allocation. Today, those details are usually associated directly with the user's server-side profile, making `ACCT` obsolete for most applications. Leave this property empty unless the server administrator or login instructions explicitly require an FTP account value.

Specifies the FTP account string sent with the `ACCT` command when a server requires an account in addition to the username and password.

### Ftp2.ActivePortRangeEnd

`Chilkat 11.7.0 · js · Ftp2 · ActivePortRangeEnd · property · read/write`

```javascript
ActivePortRangeEnd
```

· `int`

Specifies the last local TCP port that may be used for active-mode data connections. The default is `0`. Valid nonzero values are `1` through `65535`.

The range beginning with `ActivePortRangeStart` is inclusive. If `ActivePortRangeStart` is `0`, this property is ignored and the operating system chooses an ephemeral listening port. If this value is `0` or is less than `ActivePortRangeStart`, Chilkat behaves as though both endpoints equal `ActivePortRangeStart`.

Unavailable ports are skipped. Chilkat tries each port in the effective range until binding succeeds, and fails only after all ports have been tried. The range applies to both `PORT` and `EPRT` and may be changed while the control connection is already established.

**Active mode setting:** This property is used only when `Passive` is `false`. Passive mode is typically preferred because it avoids the server-initiated connection back to the client that many client-side firewalls block. When active mode is required, any fixed port range must be allowed by the client-side firewall and reachable through intervening NAT.

### Ftp2.ActivePortRangeStart

`Chilkat 11.7.0 · js · Ftp2 · ActivePortRangeStart · property · read/write`

```javascript
ActivePortRangeStart
```

· `int`

Specifies the first local TCP port that may be used for active-mode data connections. The default is `0`. Valid nonzero values are `1` through `65535`.

When this property is `0`, `ActivePortRangeEnd` is ignored and Chilkat binds the listening socket to port `0`, allowing the operating system to choose an available ephemeral port. When this property is nonzero, the effective range is inclusive. If the ending value is `0` or is less than the starting value, Chilkat tries only the starting port.

For each active-mode data connection, Chilkat tries the ports in the effective range in ascending order, skipping any port for which the listening socket cannot be bound. The operation fails only after every port in the range has been tried.

**Scope:** The range applies to both `PORT` and `EPRT` operation and may be changed after the FTP control connection has been established.

**Active mode setting:** This property is used only when `Passive` is `false`. Passive mode is typically preferred because the client initiates both the control and data connections, making it much friendlier to client-side firewalls and NAT.

### Ftp2.AllocateSize

`Chilkat 11.7.0 · js · Ftp2 · AllocateSize · property · read/write`

```javascript
AllocateSize
```

· `unsigned int`

**Rarely needed:** The FTP `ALLO` command pre-allocates disk space on the server before an upload. It is generally needed only by certain legacy systems, such as older mainframes, that require the exact file size in advance to reserve storage. Most modern FTP servers allocate space dynamically and either ignore `ALLO` or do not require it. Leave this property at its default value of `0` unless the server explicitly requires pre-allocation.

Specifies the size, in bytes, to send in an `ALLO` command before the next applicable upload. For example, a value of `20` sends `ALLO 20`. The default value of `0` disables the command.

This is a one-shot setting. It is consumed by the next applicable upload and automatically reset to `0`. It applies to normal, in-memory, text, and append uploads. A successful FTP reply indicating that allocation is unnecessary, such as reply code `202`, does not prevent the upload from continuing.

### Ftp2.AllowMlsd

`Chilkat 11.7.0 · js · Ftp2 · AllowMlsd · property · read/write · since 9.5.0.50`

```javascript
AllowMlsd
```

· `boolean`

Controls whether machine-readable directory listings are requested with `MLSD` when the server advertises support. The default is `true`.

When this property is `true` and `MLSD` is advertised, Chilkat uses `MLSD`. Otherwise, a legacy listing is used: `NLST` when `PreferNlst` is `true`, or `LIST` when it is `false`.

`MLSD` provides standardized facts such as type, size, and modification time and is generally more reliable than parsing server-specific `LIST` output. Facts not supplied by the server remain unavailable. When a `perm` fact is present, `GetPermissions` returns it rather than a UNIX-style permission string.

**Recommended setting:** Keep this property enabled unless a particular server has a broken MLSD implementation. Disabling it can reduce the accuracy or availability of timestamps, sizes, and other listing information.

### Ftp2.AuthSsl

`Chilkat 11.7.0 · js · Ftp2 · AuthSsl · property · read/write`

```javascript
AuthSsl
```

· `boolean`

**Legacy and very uncommon:** `AUTH SSL` originated in early FTP security drafts from the era when SSL was the standard encryption protocol. For modern FTP servers, use `AuthTls` instead. Most security-conscious servers require `AUTH TLS` and may reject `AUTH SSL` to enforce current security policies and prevent protocol downgrades. This property is normally needed only for a decades-old legacy server that was never updated to support `AUTH TLS`.

Set to `true` to use explicit FTP over TLS by sending `AUTH SSL` on the FTP control channel. The client first establishes a plain FTP control connection, receives the server greeting, and then upgrades that connection to TLS.

The TLS upgrade is completed before `USER` and `PASS` are sent. `ConnectOnly` performs the explicit TLS upgrade but does not log in. During `Connect`, Chilkat sends `PBSZ` and `PROT` as required by `DataProtection`. If the server responds with `530 Please login with USER and PASS`, Chilkat logs in and automatically retries those commands.

If the server accepts the `AUTH` command but rejects a required `PBSZ` or `PROT` command, the connection attempt fails. A failed connection attempt does not leave the underlying plain FTP connection open.

`AUTH SSL` is the alternative explicit-TLS command used by this property. If `Ssl` is `true`, implicit TLS takes priority. If both this property and `AuthTls` are `true` while `Ssl` is `false`, `AuthTls` takes priority and Chilkat sends `AUTH TLS`.

See also:

- [AuthTls, AuthSsl, and Ssl Properties Clarified](https://cknotes.com/ftp2-authtls-authssl-and-ssl-properties-clarified/)

### Ftp2.AuthTls

`Chilkat 11.7.0 · js · Ftp2 · AuthTls · property · read/write`

```javascript
AuthTls
```

· `boolean`

Set to `true` to use explicit FTP over TLS by sending `AUTH TLS` on the FTP control channel. The client first establishes a plain FTP control connection, receives the server greeting, and then upgrades that connection to TLS. Port `21` is conventionally used.

The TLS upgrade is completed before `USER` and `PASS` are sent. `ConnectOnly` performs the explicit TLS upgrade but does not log in. During `Connect`, Chilkat sends `PBSZ` and `PROT` as required by `DataProtection`. If the server responds with `530 Please login with USER and PASS`, Chilkat logs in and automatically retries those commands.

If the server accepts the `AUTH` command but rejects a required `PBSZ` or `PROT` command, the connection attempt fails. A failed connection attempt does not leave the underlying plain FTP connection open.

If `Ssl` is `true`, implicit TLS takes priority and this property is ignored. If both `AuthTls` and `AuthSsl` are `true` while `Ssl` is `false`, `AuthTls` takes priority.

**AuthTls versus AuthSsl:** Both properties select explicit FTPS. Their only difference is the command sent to initiate TLS: `AUTH TLS` for this property and `AUTH SSL` for `AuthSsl`.

See also:

- [AuthTls, AuthSsl, and Ssl Properties Clarified](https://cknotes.com/ftp2-authtls-authssl-and-ssl-properties-clarified/)

### Ftp2.AutoFeat

`Chilkat 11.7.0 · js · Ftp2 · AutoFeat · property · read/write`

```javascript
AutoFeat
```

· `boolean`

**Rarely changed:** Leave this property at its default value of `true` for nearly all modern FTP servers. The `FEAT` command was standardized in RFC 2389 in 1998 and is broadly supported by mainstream FTP software, including FileZilla Server, vsftpd, ProFTPD, and IIS. Set it to `false` only for a legacy or nonconforming server that mishandles `FEAT`.

Controls whether a `FEAT` command is sent automatically after login. The default is `true`. The response is processed to detect capabilities such as `MLSD`, `UTF8`, `EPSV`, `MODE Z`, and server-specific extensions.

When `AutoSyst` is also `true`, automatic `SYST` is sent first. If `UTF8` is advertised and `AutoOptsUtf8` is `true`, capability processing is followed by `OPTS UTF8 ON`.

The same capability processing can be performed later by calling `Feat` explicitly.

### Ftp2.AutoFix

`Chilkat 11.7.0 · js · Ftp2 · AutoFix · property · read/write`

```javascript
AutoFix
```

· `boolean`

Controls automatic adjustment of `Ssl`, `AuthSsl`, and `AuthTls` based solely on `Port`. The default is `true`. The only recognized ports are `21` and `990`.

| Port | Automatic adjustment |
| :--- | :--- |
| `21` | Sets `Ssl` to `false`. `AuthTls` and `AuthSsl` continue to determine whether explicit TLS is requested. |
| `990` | Sets `Ssl` to `true` and sets `AuthTls` and `AuthSsl` to `false`. |
| Any other port | Makes no changes because the intended plain, explicit-TLS, or implicit-TLS mode cannot be inferred from a custom port number. |

**Scope:** AutoFix does not probe the server or resolve arbitrary conflicting settings. It only applies the conventional meaning of ports `21` and `990`.

### Ftp2.AutoGetSizeForProgress

`Chilkat 11.7.0 · js · Ftp2 · AutoGetSizeForProgress · property · read/write`

```javascript
AutoGetSizeForProgress
```

· `boolean`

Controls whether Chilkat sends a `SIZE` command before a download so percentage-based progress can be calculated. The default is `false`. Each size query adds a control-channel round trip.

A nonzero one-shot value in `ProgressMonSize` or `ProgressMonSize64` supplies the expected size directly and avoids this additional query. Even when this property is `false`, percentage progress may be available if the server includes a usable size in its preliminary transfer reply.

### Ftp2.AutoOptsUtf8

`Chilkat 11.7.0 · js · Ftp2 · AutoOptsUtf8 · property · read/write · since 9.5.0.47`

```javascript
AutoOptsUtf8
```

· `boolean`

Controls whether `OPTS UTF8 ON` is sent automatically when a processed `FEAT` response advertises `UTF8`. The default is `true`. When UTF-8 is advertised, Chilkat sets `CommandCharset` and `DirListingCharset` to `utf-8`, overwriting values previously assigned by the application.

If `UTF8` is not advertised, the existing charset property values are left unchanged. This behavior applies both during automatic capability discovery and when `Feat` is called explicitly.

Set to `false` for a server that advertises UTF-8 but rejects the option or uses a different encoding in practice.

### Ftp2.AutoSetUseEpsv

`Chilkat 11.7.0 · js · Ftp2 · AutoSetUseEpsv · property · read/write · since 9.5.0.44`

```javascript
AutoSetUseEpsv
```

· `boolean`

**Recommended setting:** Applications should set this property to `true`. The default is `false` in current versions, but will change to `true` in Chilkat v12.0.0.

`EPSV` is preferred on modern networks because it supports both IPv4 and IPv6, whereas `PASV` cannot represent an IPv6 address. It is also more reliable through NAT and firewalls because the `EPSV` reply contains only a port number and relies on the address of the existing control connection. In contrast, a `PASV` reply includes an IP address, which can fail when a server behind NAT returns its private internal address.

Virtually all modern FTP servers, including vsftpd, ProFTPD, FileZilla Server, and IIS, support `EPSV`. It was standardized in RFC 2428 in 1998 and is widely implemented.

Controls whether `UseEpsv` is recalculated when server capabilities are processed. The default is `false`. Processing occurs during the initial connection when `AutoFeat` is `true`, or when `Feat` is called explicitly.

The result is based on both the advertised capabilities and the connection context; it is not simply a copy of whether `EPSV` appears in the `FEAT` reply. For example, an IPv4 connection may retain `UseEpsv = FALSE` even when the server advertises `EPSV`. Automatic recalculation can overwrite an explicitly assigned value, and each new connection recalculates it for the new session.

If an attempted `EPSV` command is rejected, Chilkat falls back to `PASV` for that data connection. The failed attempt is not remembered as a session-wide reason to disable future `EPSV` attempts.

### Ftp2.AutoSyst

`Chilkat 11.7.0 · js · Ftp2 · AutoSyst · property · read/write`

```javascript
AutoSyst
```

· `boolean`

Controls whether a `SYST` command is sent automatically after login. The default is `true`. The server's operating-system type can help Chilkat interpret legacy `LIST` output and other server-specific behavior.

When both this property and `AutoFeat` are `true`, automatic `SYST` occurs before automatic `FEAT`.

Set to `false` only when a particular server rejects or mishandles `SYST`.

### Ftp2.AutoXcrc

`Chilkat 11.7.0 · js · Ftp2 · AutoXcrc · property · read/write`

```javascript
AutoXcrc
```

· `boolean`

Controls automatic post-upload verification with the server-specific `XCRC` command. The default is `false`. When enabled and the server supports `XCRC`, Chilkat requests a CRC after an upload and treats a mismatch as transfer failure.

If `XCRC` support is not detected, Chilkat does not send the verification command and the upload proceeds normally. This extension is not part of the core FTP standard and is not supported by every server. Capability detection normally depends on a processed `FEAT` response.

**Integrity scope:** CRC verification can detect accidental corruption in transit or storage, but it is not a cryptographic authenticity check.

### Ftp2.BandwidthThrottleDown

`Chilkat 11.7.0 · js · Ftp2 · BandwidthThrottleDown · property · read/write`

```javascript
BandwidthThrottleDown
```

· `int`

Specifies the approximate maximum download rate in bytes per second. The default value of `0` disables throttling.

Client-side download throttling is approximate because the server continues sending as permitted by TCP. The operating system's socket buffers absorb data between reads, so very small transfers may complete before the configured rate can be meaningfully enforced.

### Ftp2.BandwidthThrottleUp

`Chilkat 11.7.0 · js · Ftp2 · BandwidthThrottleUp · property · read/write`

```javascript
BandwidthThrottleUp
```

· `int`

Specifies the approximate maximum upload rate in bytes per second. The default value of `0` disables throttling.

The limit is averaged over the transfer. Very small uploads may complete before the configured rate can be closely approximated.

### Ftp2.ClientIpAddress

`Chilkat 11.7.0 · js · Ftp2 · ClientIpAddress · property · read/write`

```javascript
ClientIpAddress
```

· `string`

**This property is normally left unset.** Set it only on a multihomed computer when the application must bind the outgoing connection to a specific local network interface.

Specify a numeric IPv4 or IPv6 address, not a hostname. When the property is empty, the operating system automatically chooses the local address.

See also:

- [Important Bind to Adapter Notes for Windows](http://www.cknotes.com/?p=376)

### Ftp2.CommandCharset

`Chilkat 11.7.0 · js · Ftp2 · CommandCharset · property · read/write`

```javascript
CommandCharset
```

· `string`

Specifies the character encoding used by high-level FTP operations for commands containing non-ASCII text, including remote paths and filenames. The default is `ANSI`. Charset names and the keyword `ANSI` are case-insensitive. An unrecognized charset name is clamped to `utf-8`, and the getter returns `utf-8`.

**Usually changed automatically to UTF-8:** Although the default value is `ANSI`, when the server advertises UTF-8 and `AutoOptsUtf8` is enabled, Chilkat automatically changes this property to `utf-8`. Nearly all modern FTP servers support UTF-8, so `utf-8` is typically the effective value after connecting. If UTF-8 is not advertised, the existing value is left unchanged.

**What `ANSI` means:** It does not name one specific charset. It tells Chilkat to use the system-default encoding or default system locale. Typical examples include `windows-1252` on Western-language Windows systems, `windows-1251` for Cyrillic, `windows-1256` for Arabic, and `windows-932` (Shift_JIS) for Japanese. On many modern Unix-like systems, the default locale encoding is `utf-8`. The actual encoding therefore depends on the computer on which the application runs.

Changing this property after connecting affects subsequent high-level FTP commands. If a character cannot be represented in a selected single-byte encoding, the character is omitted from the transmitted command; use `utf-8` to preserve full Unicode names.

**FTP filename encoding:** The original FTP protocol did not define one universal encoding for path names. The client and server must use the same encoding; UTF-8 is preferred when the server supports it.

### Ftp2.ConnectFailReason

`Chilkat 11.7.0 · js · Ftp2 · ConnectFailReason · property · read-only`

```javascript
ConnectFailReason
```

· `int`, `read-only`

Contains a numeric reason code after `Connect` or `ConnectOnly` fails. Use this value for broad classification and inspect `LastErrorText` for detailed diagnostics.

| Code | Meaning |
| :--- | :--- |
| `0` | Success. |
| `1` | The hostname is empty. |
| `2` | DNS lookup failed. |
| `3` | DNS lookup timed out. |
| `4` | Cancelled by the application. |
| `5` | Internal failure. |
| `6` | TCP connection timed out. |
| `7` | TCP connection was rejected or otherwise failed. |
| `100` | Internal TLS failure. |
| `101` | Failed to send the TLS ClientHello. |
| `102` | An unexpected TLS handshake message was received. |
| `103` | Failed to read the ServerHello. |
| `104` | The server did not provide a certificate. |
| `105` | Unexpected TLS protocol version. |
| `106` | Server certificate verification failed. |
| `107` | The negotiated TLS version is not allowed. |
| `109` | Failed while reading TLS handshake messages. |
| `110` | Failed to send the client-certificate handshake message. |
| `111` | Failed to send the client key exchange. |
| `112` | The client certificate private key is not accessible. |
| `113` | Failed to send client certificate verification. |
| `114` | Failed to send ChangeCipherSpec. |
| `115` | Failed to send the Finished handshake message. |
| `116` | The server Finished message is invalid. |
| `200` | Connected, but the FTP greeting was not received. |
| `201` | The `AUTH TLS` or `AUTH SSL` upgrade failed. |
| `300` | An asynchronous operation is already in progress. |
| `301` | FTP authentication failed. |

A successful connection sets this property to `0`. An authentication failure can set it to `301` while `ConnectVerified` remains `true`, because the TCP and FTP connection succeeded before the login was rejected.

### Ftp2.ConnectTimeout

`Chilkat 11.7.0 · js · Ftp2 · ConnectTimeout · property · read/write`

```javascript
ConnectTimeout
```

· `int`

Specifies the maximum number of seconds to wait for a remote endpoint to accept a TCP connection. The default is `30`. A value of `0` or any negative value waits indefinitely.

This timeout applies whenever Ftp2 establishes a TCP connection, including the FTP control connection, FTP data connections, and connections to configured proxy servers.

It covers only TCP connection establishment. It does not apply to TLS handshakes, FTP greetings or replies, authentication, file data, or any other communication after the TCP connection has been accepted.

### Ftp2.ConnectVerified

`Chilkat 11.7.0 · js · Ftp2 · ConnectVerified · property · read-only`

```javascript
ConnectVerified
```

· `boolean`, `read-only`

Indicates whether the TCP connection to the FTP server was successfully established during the most recent connection attempt. It does not indicate that FTP authentication succeeded; see `LoginVerified`.

This is a verification result, not a current-socket-state property. It remains `true` after `Disconnect` if the preceding connection was successfully established.

### Ftp2.CrlfMode

`Chilkat 11.7.0 · js · Ftp2 · CrlfMode · property · read/write`

```javascript
CrlfMode
```

· `int`

Controls line-ending conversion when downloading in ASCII transfer mode. The default is `0`.

| Value | Downloaded text |
| :--- | :--- |
| `0` | Leaves line endings as received. |
| `1` | Converts line endings to CRLF. |
| `2` | Converts line endings to LF. |
| `3` | Converts line endings to CR. |

**Binary mode:** This property has no effect on binary transfers. Use binary mode for files whose bytes must be preserved exactly.

### Ftp2.CurBytesReceived

`Chilkat 11.7.0 · js · Ftp2 · CurBytesReceived · property · read-only · since 11.0.0`

```javascript
CurBytesReceived
```

· `unsigned int`, `read-only`

Returns the number of bytes received by the current or most recently completed FTP download as a 32-bit unsigned integer. The value is updated while the transfer is in progress and may be read from another thread to display progress. A subsequent upload does not clear the retained download count.

### Ftp2.CurBytesReceived64

`Chilkat 11.7.0 · js · Ftp2 · CurBytesReceived64 · property · read-only · since 11.0.0`

```javascript
CurBytesReceived64
```

· `int64`, `read-only`

Returns the number of bytes received by the current or most recently completed FTP download as a 64-bit integer. The value is updated while the transfer is in progress and may be read from another thread to display progress. A subsequent upload does not clear the retained download count.

### Ftp2.CurBytesReceivedStr

`Chilkat 11.7.0 · js · Ftp2 · CurBytesReceivedStr · property · read-only · since 11.0.0`

```javascript
CurBytesReceivedStr
```

· `string`, `read-only`

Returns the number of bytes received by the current or most recently completed FTP download as a decimal string. The value is updated while the transfer is in progress and may be read from another thread to display progress. A subsequent upload does not clear the retained download count.

### Ftp2.CurBytesSent

`Chilkat 11.7.0 · js · Ftp2 · CurBytesSent · property · read-only · since 11.0.0`

```javascript
CurBytesSent
```

· `unsigned int`, `read-only`

Returns the number of bytes sent by the current or most recently completed FTP upload as a 32-bit unsigned integer. The value is updated while the transfer is in progress and may be read from another thread to display progress. A subsequent download does not clear the retained upload count.

### Ftp2.CurBytesSent64

`Chilkat 11.7.0 · js · Ftp2 · CurBytesSent64 · property · read-only · since 11.0.0`

```javascript
CurBytesSent64
```

· `int64`, `read-only`

Returns the number of bytes sent by the current or most recently completed FTP upload as a 64-bit integer. The value is updated while the transfer is in progress and may be read from another thread to display progress. A subsequent download does not clear the retained upload count.

### Ftp2.CurBytesSentStr

`Chilkat 11.7.0 · js · Ftp2 · CurBytesSentStr · property · read-only · since 11.0.0`

```javascript
CurBytesSentStr
```

· `string`, `read-only`

Returns the number of bytes sent by the current or most recently completed FTP upload as a decimal string. The value is updated while the transfer is in progress and may be read from another thread to display progress. A subsequent download does not clear the retained upload count.

### Ftp2.DataProtection

`Chilkat 11.7.0 · js · Ftp2 · DataProtection · property · read/write · since 9.5.0.52`

```javascript
DataProtection
```

· `string`

Specifies the protection level for FTP data connections. The value is compared case-insensitively. The default is `control`.

| Value | Behavior |
| :--- | :--- |
| `control` | Data connections use the same protection state as the control connection. If the control connection is unencrypted, no `PBSZ` or `PROT` commands are sent. |
| `clear` | Data connections are requested as unencrypted. If the control connection is also unencrypted, no `PBSZ` or `PROT` commands are sent. If the control connection uses TLS, Chilkat sends `PBSZ 0` followed by `PROT C`. If the server rejects `PROT C` but accepts `PROT P`, Chilkat falls back to private data protection. |
| `private` | Data connections are protected with TLS. For an encrypted control connection, Chilkat sends `PBSZ 0` followed by `PROT P`. |

`Connect` sends the required `PBSZ` and `PROT` commands. If the server requires login first and replies with `530 Please login with USER and PASS`, Chilkat authenticates and automatically retries them. A required protection setup fails only when no acceptable protection level can be established.

**Control and data channels:** FTP uses one long-lived control connection and a separate data connection for each listing, upload, or download. FTPS can protect these channels independently.

### Ftp2.DirListingCharset

`Chilkat 11.7.0 · js · Ftp2 · DirListingCharset · property · read/write`

```javascript
DirListingCharset
```

· `string`

Specifies the character encoding used only to decode directory-listing and related server-response bytes. It applies to responses from `LIST`, `NLST`, and `MLSD`. It does not affect commands, remote paths, filenames, usernames, passwords, or other text sent to the server.

The default is `ANSI`. Charset names and the keyword `ANSI` are case-insensitive. `ANSI` means the platform's system-default single-byte encoding or default system locale; on Windows, this is the active code page (ACP).

**What `ANSI` means:** It does not name one specific charset. It tells Chilkat to use the system-default encoding or default system locale. Typical examples include `windows-1252` on Western-language Windows systems, `windows-1251` for Cyrillic, `windows-1256` for Arabic, and `windows-932` (Shift_JIS) for Japanese. On many modern Unix-like systems, the default locale encoding is `utf-8`. The actual encoding therefore depends on the computer on which the application runs.

Using the wrong encoding can produce incorrectly decoded names without causing the listing operation itself to fail. When `AutoOptsUtf8` is enabled and UTF-8 support is advertised, Chilkat changes this property to `utf-8`, even if the application previously assigned another value. If UTF-8 is not advertised, the existing value is left unchanged.

See also:

- [Charsets Supported by Chilkat](http://www.cknotes.com/chilkat-charsets-character-encodings-supported/)

### Ftp2.DownloadTransferRate

`Chilkat 11.7.0 · js · Ftp2 · DownloadTransferRate · property · read-only`

```javascript
DownloadTransferRate
```

· `int`, `read-only`

Returns the current average download rate in bytes per second. The value is updated during synchronous and asynchronous downloads and describes the download in progress or the most recently completed download. A subsequent upload does not clear the retained download rate.

### Ftp2.EnableSecrets

`Chilkat 11.7.0 · js · Ftp2 · EnableSecrets · property · read/write · since 11.5.0`

```javascript
EnableSecrets
```

**Full documentation for this property (same in every language):** [More Detailed Information About EnableSecrets](https://www.chilkatsoft.com/ai-docs/v/11.7.0/articles/secret_specification_strings.md)

· `boolean`

Controls automatic resolution of credential values from secure operating-system storage. The default is `false`. When enabled, supported password properties may contain a secret specification beginning with `!!` instead of the literal password.

```
!![appName|]service[|domain]|username
```

Secret specifications are supported by `Password`, `HttpProxyPassword`, `ProxyPassword`, and `SocksPassword`. Chilkat resolves them through Windows Credential Manager on Windows or Apple Keychain on macOS.

**Credential handling:** This feature avoids embedding plaintext credentials in source code or configuration. Access to the secret still depends on the permissions of the process and operating-system account.

### Ftp2.ForcePortIpAddress

`Chilkat 11.7.0 · js · Ftp2 · ForcePortIpAddress · property · read/write`

```javascript
ForcePortIpAddress
```

· `string`

Specifies the IPv4 address advertised to the server for active-mode data connections. This property affects both `PORT` and `EPRT`. Supply a numeric IPv4 address, the keyword `control`, or an IPv4 address prefixed with `bind-`. IPv6 values are not accepted. Keywords and prefixes are case-insensitive.

- `control` uses the local IPv4 address of the established FTP control socket.
- `bind-192.0.2.10` advertises the address and also binds the local data-listener socket to that address.
- A plain IPv4 address changes the address sent in `PORT` or `EPRT` without explicitly binding the listener to that address.

If `ClientIpAddress` is set, this property should specify the same local address. When a `bind-` value is used with `ActivePortRangeStart` and `ActivePortRangeEnd`, Chilkat binds to the specified address while searching the effective range for an available port.

**Active mode setting:** This property is used only when `Passive` is `false`. Passive mode is typically preferred because the client initiates both the control and data connections, making it much friendlier to client-side firewalls and NAT.

**NAT caution:** The advertised address must be reachable from the FTP server. Incorrect active-mode addressing commonly causes the control command to succeed while the subsequent data connection fails.

### Ftp2.Greeting

`Chilkat 11.7.0 · js · Ftp2 · Greeting · property · read-only`

```javascript
Greeting
```

· `string`, `read-only`

Contains the initial FTP server greeting received for the most recent connection immediately after the TCP or implicit-TLS connection was established. It normally begins with reply code `220` and may include server identification or policy information.

The value remains available after `Disconnect`.

### Ftp2.HasModeZ

`Chilkat 11.7.0 · js · Ftp2 · HasModeZ · property · read-only`

```javascript
HasModeZ
```

· `boolean`, `read-only`

Indicates whether the FTP server advertised support for `MODE Z`, which compresses FTP data streams using the DEFLATE algorithm.

This property becomes meaningful after Chilkat has processed a successful `FEAT` response, either automatically because `AutoFeat` is `true` or through an explicit call to `Feat`. Before capability discovery, a value of `false` does not establish that the server lacks `MODE Z` support.

Call `SetModeZ` after connecting to enable or disable compressed transfer mode.

### Ftp2.Hostname

`Chilkat 11.7.0 · js · Ftp2 · Hostname · property · read/write`

```javascript
Hostname
```

· `string`

Specifies the FTP server hostname or numeric IPv4/IPv6 address. Do not include a URL scheme, path, or port; configure the port separately with `Port`.

### Ftp2.HttpProxyAuthMethod

`Chilkat 11.7.0 · js · Ftp2 · HttpProxyAuthMethod · property · read/write`

```javascript
HttpProxyAuthMethod
```

· `string`

Specifies the authentication method used with an HTTP proxy. Supported values are `Basic` and `NTLM`. Leave empty when the proxy does not require authentication.

### Ftp2.HttpProxyDomain

`Chilkat 11.7.0 · js · Ftp2 · HttpProxyDomain · property · read/write`

```javascript
HttpProxyDomain
```

· `string`

Specifies the Windows domain used for NTLM authentication to the HTTP proxy. It is ignored for Basic authentication and may be left empty when the username already includes the required domain information.

### Ftp2.HttpProxyHostname

`Chilkat 11.7.0 · js · Ftp2 · HttpProxyHostname · property · read/write`

```javascript
HttpProxyHostname
```

· `string`

Specifies the hostname or numeric IP address of an HTTP proxy used to establish the FTP control connection. Leave empty to connect directly.

### Ftp2.HttpProxyPassword

`Chilkat 11.7.0 · js · Ftp2 · HttpProxyPassword · property · read/write`

```javascript
HttpProxyPassword
```

· `string`

Specifies the password used to authenticate to the HTTP proxy. It is used together with `HttpProxyUsername` and `HttpProxyAuthMethod`.

### Ftp2.HttpProxyPort

`Chilkat 11.7.0 · js · Ftp2 · HttpProxyPort · property · read/write`

```javascript
HttpProxyPort
```

· `int`

Specifies the TCP port of the HTTP proxy. Common values include `8080` and `3128`, but the correct value is determined by the proxy configuration.

### Ftp2.HttpProxyUsername

`Chilkat 11.7.0 · js · Ftp2 · HttpProxyUsername · property · read/write`

```javascript
HttpProxyUsername
```

· `string`

Specifies the username used to authenticate to the HTTP proxy. Leave empty when the proxy allows unauthenticated connections.

### Ftp2.IdleTimeoutMs

`Chilkat 11.7.0 · js · Ftp2 · IdleTimeoutMs · property · read/write`

```javascript
IdleTimeoutMs
```

· `int`

Specifies the maximum period, in milliseconds, during which no control-channel response or forward upload progress is observed. The default is `60000`. A value of `0` or any negative value waits indefinitely.

During an upload, the same limit applies when the operating-system send buffer remains full because the server is not consuming data.

### Ftp2.IsConnected

`Chilkat 11.7.0 · js · Ftp2 · IsConnected · property · read-only`

```javascript
IsConnected
```

· `boolean`, `read-only`

Deprecated. Indicates whether the object appears to be connected and authenticated. Reading this property may send `NOOP` to test the session. Use `CheckConnection` instead.

### Ftp2.KeepSessionLog

`Chilkat 11.7.0 · js · Ftp2 · KeepSessionLog · property · read/write`

```javascript
KeepSessionLog
```

· `boolean`

Controls collection of an in-memory FTP protocol log. When enabled, commands and server replies are available in `SessionLog`. Use `ClearSessionLog` to discard previously collected text.

### Ftp2.LargeFileMeasures

`Chilkat 11.7.0 · js · Ftp2 · LargeFileMeasures · property · read/write · since 9.5.0.66`

```javascript
LargeFileMeasures
```

· `boolean`

Controls an additional keepalive measure for very long uploads and downloads. The default is `false`. When enabled, Chilkat sends `NOOP` on the FTP control channel once per minute while a long-running file transfer is in progress.

This helps prevent the otherwise idle control connection from being closed by the server, a firewall, or a NAT device while file data continues on the separate data connection.

**FTP connection model:** File contents travel over a data connection, while FTP commands and replies use the control connection. During a long transfer, the control connection may appear idle even though the data connection remains active.

### Ftp2.LastReply

`Chilkat 11.7.0 · js · Ftp2 · LastReply · property · read-only`

```javascript
LastReply
```

· `string`, `read-only`

Contains the most recent FTP control-channel reply, including its three-digit status code and message. Examples include `250 Directory successfully changed.` and `550 Failed to change directory.`

The value is updated by successful as well as failed commands. After `Disconnect`, it normally contains the server's reply to `QUIT`, such as `221 Goodbye.`. Some replies are multiline; use this property together with the method return value and `LastErrorText` when diagnosing a failure.

### Ftp2.ListOption

`Chilkat 11.7.0 · js · Ftp2 · ListOption · property · read/write · since 11.4.0`

```javascript
ListOption
```

· `string`

Specifies an option string appended literally to the legacy `LIST` command, such as `-a`. For example, setting this property to `-a` sends `LIST -a`. Chilkat does not interpret the option locally. It has no effect when `AllowMlsd` causes `MLSD` to be used or when `PreferNlst` causes `NLST` to be used.

`LIST` options and output formats are not standardized by FTP. Many UNIX-like servers pass the option to an underlying `ls` implementation, while other servers may reject or interpret it differently.

### Ftp2.ListPattern

`Chilkat 11.7.0 · js · Ftp2 · ListPattern · property · read/write`

```javascript
ListPattern
```

· `string`

Specifies the case-insensitive wildcard pattern applied to the cached listing of the current remote directory. The default is `*`. It affects methods such as `GetDirCount`, `GetFilename`, `GetIsDirectory`, `GetSize`, and the listing timestamp methods.

Chilkat retrieves the full directory listing and applies this pattern locally; the pattern is not appended to `LIST`, `NLST`, or `MLSD`. For example, `*.txt` also matches a name such as `UPPER.TXT`.

Specify only a name pattern, such as `*.txt`. To list `subdir/*.txt`, first call `ChangeRemoteDir` for `subdir`, then set this property to `*.txt`.

**Listing cache:** Changing this property invalidates the cached directory listing, so the next indexed listing call retrieves a fresh listing from the server.

See also:

- [How ListPattern can affect the Quality of Directory Information](http://www.cknotes.com/?p=427)

### Ftp2.LoginVerified

`Chilkat 11.7.0 · js · Ftp2 · LoginVerified · property · read-only`

```javascript
LoginVerified
```

· `boolean`, `read-only`

Indicates whether FTP authentication succeeded during the most recent login attempt. A TCP connection may be established even when this property is `false`; for example, rejected credentials leave `ConnectVerified` `true` and this property `false`.

This is a verification result, not a current-socket-state property. It remains `true` after `Disconnect` if the preceding session was successfully authenticated.

### Ftp2.PartialTransfer

`Chilkat 11.7.0 · js · Ftp2 · PartialTransfer · property · read-only`

```javascript
PartialTransfer
```

· `boolean`, `read-only`

Indicates whether the most recent download method received some, but not all, of the remote file. It is `false` when no data was received or when the complete file was received.

This property helps distinguish a mid-transfer failure from a failure that occurred before any file data arrived.

### Ftp2.Passive

`Chilkat 11.7.0 · js · Ftp2 · Passive · property · read/write`

```javascript
Passive
```

· `boolean`

Selects the FTP data-connection mode. The default is `true` for passive mode. Set to `false` for active mode.

| Mode | Connection direction |
| :--- | :--- |
| Passive | The server listens and the client connects to the server for each data transfer. |
| Active | The client listens and the server connects back to the client. |

**Typical choice: Passive mode.** Passive mode is typically used because it is much friendlier to client-side firewalls and NAT (Network Address Translation). In active mode, the server attempts to initiate a data connection back to the client, which many client-side firewalls block. In passive mode, the client initiates both the control and data connections to the server.

See also:

- [Passive vs. Active Mode Explained](https://www.chilkatsoft.com/p/p_272.asp)
- [Determining FTP2 Connection Settings](http://www.cknotes.com/?p=282)

### Ftp2.PassiveUseHostAddr

`Chilkat 11.7.0 · js · Ftp2 · PassiveUseHostAddr · property · read/write`

```javascript
PassiveUseHostAddr
```

· `boolean`

Controls how the address returned by `PASV` is handled. The default is `true`. When enabled, Chilkat ignores the IP address embedded in the server's `PASV` reply and connects to the control connection's server address using only the returned port.

This avoids private or otherwise unreachable addresses returned by FTP servers behind NAT, especially when TLS prevents a network device from rewriting the reply.

### Ftp2.Password

`Chilkat 11.7.0 · js · Ftp2 · Password · property · read/write`

```javascript
Password
```

· `string`

Specifies the password used for FTP authentication. For anonymous FTP, this is commonly an email address or arbitrary identifying string. Applications that already store the password in a `SecureString` should use `SetSecurePassword` instead.

### Ftp2.Port

`Chilkat 11.7.0 · js · Ftp2 · Port · property · read/write`

```javascript
Port
```

· `int`

Specifies the FTP server port. Port `21` is conventionally used for plain FTP or explicit FTPS, and port `990` is conventionally used for implicit FTPS.

When `AutoFix` is `true`, only these two port numbers cause automatic changes to `Ssl`, `AuthSsl`, and `AuthTls`. A custom port leaves all three TLS-mode properties unchanged.

### Ftp2.PreferIpv6

`Chilkat 11.7.0 · js · Ftp2 · PreferIpv6 · property · read/write`

```javascript
PreferIpv6
```

· `boolean`

Controls the preferred address family when DNS resolution returns both IPv4 and IPv6 addresses. The default is `false`, which prefers IPv4. Set it to `true` to prefer IPv6.

### Ftp2.PreferNlst

`Chilkat 11.7.0 · js · Ftp2 · PreferNlst · property · read/write`

```javascript
PreferNlst
```

· `boolean`

Controls whether `NLST` is preferred over `LIST` when a legacy directory listing is required. The default is `false`. This property is consulted only when `AllowMlsd` does not result in `MLSD` being used.

`NLST` generally returns names only. Do not rely on indexed sizes, timestamps, ownership, group, or permission information after an `NLST` listing. Because `NLST` does not reliably identify entry types, Chilkat may send additional commands, such as directory-change tests, to determine which names are directories.

**When to use:** Enable this only for a server whose LIST output truncates or corrupts names. Keep `AllowMlsd` enabled whenever possible because MLSD is the standardized machine-readable listing command.

### Ftp2.ProgressMonSize

`Chilkat 11.7.0 · js · Ftp2 · ProgressMonSize · property · read/write`

```javascript
ProgressMonSize
```

· `int`

Specifies the expected size, in bytes, of the next file downloaded by `GetFile` when the size is not otherwise known. Chilkat uses the value to calculate percentage progress.

This is a one-shot setting. It is consumed by the next applicable download and automatically reset to `0`. Set it immediately before the download. When a nonzero value is supplied, Chilkat does not need the additional size query controlled by `AutoGetSizeForProgress`.

If this property is zero, percentage progress may still be available when the server's preliminary transfer reply includes the file size.

### Ftp2.ProgressMonSize64

`Chilkat 11.7.0 · js · Ftp2 · ProgressMonSize64 · property · read/write`

```javascript
ProgressMonSize64
```

· `int64`

The 64-bit form of `ProgressMonSize`. Specifies the expected size, in bytes, of the next download when the value may exceed the 32-bit integer range. It is consumed by the next applicable download and automatically reset to `0`.

### Ftp2.ProxyHostname

`Chilkat 11.7.0 · js · Ftp2 · ProxyHostname · property · read/write`

```javascript
ProxyHostname
```

· `string`

Specifies the hostname or IP address of a traditional FTP application proxy or firewall. This is distinct from an HTTP CONNECT proxy and from a SOCKS proxy. The login sequence is selected by `ProxyMethod`.

### Ftp2.ProxyMethod

`Chilkat 11.7.0 · js · Ftp2 · ProxyMethod · property · read/write`

```javascript
ProxyMethod
```

· `int`

Selects the login sequence required by a traditional FTP proxy or firewall. The default is `0`, meaning no FTP proxy. Configure `ProxyHostname`, `ProxyPort`, and the required proxy credentials before connecting.

| Value | Sequence sent |
| :--- | :--- |
| `1` — SITE | ``` · USER ProxyUsername · PASS ProxyPassword · SITE Hostname · USER Username · PASS Password · ``` |
| `2` — USER user@site | ``` · USER Username@Hostname:Port · PASS Password · ``` |
| `3` — USER with proxy login | ``` · USER ProxyUsername · PASS ProxyPassword · USER Username@Hostname:Port · PASS Password · ``` |
| `4` — USER/PASS/ACCT | ``` · USER Username@Hostname:Port ProxyUsername · PASS Password · ACCT ProxyPassword · ``` |
| `5` — OPEN | ``` · USER ProxyUsername · PASS ProxyPassword · OPEN Hostname · USER Username · PASS Password · ``` |
| `6` — firewall ID | ``` · USER ProxyUsername@Hostname · USER Username · PASS Password · ``` |
| `7` | ``` · USER ProxyUsername · USER ProxyPassword · SITE Hostname:Port · USER Username · PASS Password · ``` |
| `8` | ``` · USER Username@ProxyUsername@Hostname · PASS Password@ProxyPassword · ``` |
| `9` | ``` · ProxyUsername · ProxyPassword · Username · Password · ``` |

**Server-specific feature:** These sequences describe historical FTP firewall conventions, not one standardized proxy protocol. Use the value required by the proxy administrator.

### Ftp2.ProxyPassword

`Chilkat 11.7.0 · js · Ftp2 · ProxyPassword · property · read/write`

```javascript
ProxyPassword
```

· `string`

Specifies the password used to authenticate to a traditional FTP proxy or firewall. Its placement in the login exchange depends on `ProxyMethod`.

### Ftp2.ProxyPort

`Chilkat 11.7.0 · js · Ftp2 · ProxyPort · property · read/write`

```javascript
ProxyPort
```

· `int`

Specifies the TCP port on which the traditional FTP proxy or firewall accepts connections.

### Ftp2.ProxyUsername

`Chilkat 11.7.0 · js · Ftp2 · ProxyUsername · property · read/write`

```javascript
ProxyUsername
```

· `string`

Specifies the username used to authenticate to a traditional FTP proxy or firewall. Its placement in the login exchange depends on `ProxyMethod`.

### Ftp2.ReadTimeout

`Chilkat 11.7.0 · js · Ftp2 · ReadTimeout · property · read/write`

```javascript
ReadTimeout
```

· `int`

Specifies the maximum number of seconds that a data connection may remain without receiving another byte. The default is `60`. A value of `0` or any negative value waits indefinitely.

This is an inactivity timeout, not a limit on total transfer duration. Receiving any data, even a single byte, resets the timer and begins a new full timeout interval. A large download may therefore continue indefinitely as long as data keeps arriving within the configured interval.

### Ftp2.RequireSslCertVerify

`Chilkat 11.7.0 · js · Ftp2 · RequireSslCertVerify · property · read/write`

```javascript
RequireSslCertVerify
```

· `boolean`

Controls verification of the FTP server's TLS certificate chain.

| Value | Behavior |
| :--- | :--- |
| `false` (default) | A connection is not rejected solely because normal certificate-chain verification fails. |
| `true` | The connection fails when the certificate is expired, is not yet valid, its signature is invalid, or its chain cannot be verified to a trusted root. |

Certificate-chain verification is separate from hostname matching and public-key pinning. Hostname matching, when required, is enforced independently even when this property is `false`. `TlsPinSet` supplements rather than replaces normal certificate verification.

The hostname used for the TLS connection is also used for Server Name Indication (SNI) and certificate hostname comparison.

### Ftp2.RestartNext

`Chilkat 11.7.0 · js · Ftp2 · RestartNext · property · read/write`

```javascript
RestartNext
```

· `boolean`

Set to `true` to request that the next applicable upload or download resume from existing content instead of starting over. Unrelated FTP commands do not consume the setting. The next applicable transfer consumes it and automatically resets it to `false`.

For a resumed upload, Chilkat obtains the existing remote size, begins reading the local content at that offset, and appends the remaining bytes. For a resumed download, Chilkat uses the existing destination length as the `REST` offset and appends the remaining remote bytes.

The setting applies to the ordinary file, `BinData`, and `StringBuilder` upload and download methods, including `PutFile`, `PutFileBd`, `PutFileSb`, `GetFile`, `GetFileBd`, and `GetFileSb`.

Resume requires compatible server support and a correct partial local or remote file. The application should verify that the existing content belongs to the same file version before resuming.

### Ftp2.SessionLog

`Chilkat 11.7.0 · js · Ftp2 · SessionLog · property · read-only`

```javascript
SessionLog
```

· `string`, `read-only`

Contains the in-memory FTP session log collected while `KeepSessionLog` is `true`. The log includes protocol commands and server replies and is useful for troubleshooting. Passwords and other sensitive information may appear; handle the text accordingly.

### Ftp2.SocksHostname

`Chilkat 11.7.0 · js · Ftp2 · SocksHostname · property · read/write`

```javascript
SocksHostname
```

· `string`

Specifies the hostname or IP address of the SOCKS proxy. It is used only when `SocksVersion` is `4` or `5`.

### Ftp2.SocksPassword

`Chilkat 11.7.0 · js · Ftp2 · SocksPassword · property · read/write`

```javascript
SocksPassword
```

· `string`

Specifies the password for SOCKS5 username/password authentication. It is ignored for SOCKS4, which has no password-authentication field.

### Ftp2.SocksPort

`Chilkat 11.7.0 · js · Ftp2 · SocksPort · property · read/write`

```javascript
SocksPort
```

· `int`

Specifies the SOCKS proxy port. The default is `1080`. It is used only when `SocksVersion` is `4` or `5`.

### Ftp2.SocksUsername

`Chilkat 11.7.0 · js · Ftp2 · SocksUsername · property · read/write`

```javascript
SocksUsername
```

· `string`

Specifies the SOCKS user identifier. SOCKS5 may use it with password authentication; SOCKS4 sends it as the protocol user ID. It is used only when `SocksVersion` is `4` or `5`.

### Ftp2.SocksVersion

`Chilkat 11.7.0 · js · Ftp2 · SocksVersion · property · read/write`

```javascript
SocksVersion
```

· `int`

Selects SOCKS proxy usage.

| Value | Behavior |
| :--- | :--- |
| `0` | Default. Connect directly without a SOCKS proxy. |
| `4` | Connect through a SOCKS4 proxy. |
| `5` | Connect through a SOCKS5 proxy. |

### Ftp2.SoRcvBuf

`Chilkat 11.7.0 · js · Ftp2 · SoRcvBuf · property · read/write`

```javascript
SoRcvBuf
```

· `int`

Specifies the socket receive-buffer size. The default is `4194304` bytes. Normally this property should remain unchanged.

When download throughput is unexpectedly low, testing a larger value may help. Values should generally be multiples of `4096`.

See also:

- [More Information about TCP performance and Buffer Sizes](http://www.cknotes.com/?p=446)

### Ftp2.SoSndBuf

`Chilkat 11.7.0 · js · Ftp2 · SoSndBuf · property · read/write`

```javascript
SoSndBuf
```

· `int`

Specifies the socket send-buffer size. The default is `262144` bytes. Normally this property should remain unchanged.

When upload throughput is unexpectedly low, testing values such as `524288` or `1048576` may help. Values should generally be multiples of `4096`.

See also:

- [More Information about TCP performance and Buffer Sizes](http://www.cknotes.com/?p=446)

### Ftp2.Ssl

`Chilkat 11.7.0 · js · Ftp2 · Ssl · property · read/write`

```javascript
Ssl
```

· `boolean`

Set to `true` to use implicit FTP over TLS. TLS begins immediately after the TCP connection is established, before the FTP greeting is received. Port `990` is conventionally used for implicit FTPS.

This property has priority over `AuthTls` and `AuthSsl`. If `Ssl` is `true`, implicit TLS is used even when either explicit-TLS property is also `true`. `ConnectOnly` performs the implicit TLS handshake but does not send `USER` or `PASS`.

**TLS-mode precedence:** `Ssl` has highest priority. When it is `false`, `AuthTls` takes priority over `AuthSsl`. When all three properties are `false`, plain FTP is used.

**Protocol distinction:** FTPS is FTP protected by TLS. SFTP is a different protocol carried by SSH and is implemented by the `SFtp` class.

See also:

- [AuthTls, AuthSsl, and Ssl Properties Clarified](https://cknotes.com/ftp2-authtls-authssl-and-ssl-properties-clarified/)

### Ftp2.SslAllowedCiphers

`Chilkat 11.7.0 · js · Ftp2 · SslAllowedCiphers · property · read/write · since 9.5.0.48`

```javascript
SslAllowedCiphers
```

· `string`

Restricts the cipher suites and selected TLS security requirements offered for FTP TLS connections.

Leave this property empty to allow all cipher suites implemented by the installed Chilkat version. To restrict negotiation, provide a comma-separated list in preference order, for example:

```
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384, TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
```

The server chooses from the cipher suites offered by the client; the client cannot force a suite the server does not support.

The list may also contain these policy keywords:

- `rsa1024` or `rsa2048` to require a minimum RSA server-key size.
- `secure-renegotiation` to require secure TLS renegotiation.
- `best-practices` to use the security policy recommended by the installed Chilkat version.

Legacy keywords such as `aes256-cbc`, `aes128-cbc`, `3des-cbc`, and `rc4` remain recognized for compatibility, but explicitly listing acceptable suites is preferred.

### Ftp2.SslProtocol

`Chilkat 11.7.0 · js · Ftp2 · SslProtocol · property · read/write`

```javascript
SslProtocol
```

· `string`

Selects the TLS protocol version or minimum version allowed for secure FTP connections.

The complete list of accepted values is:

```
default
TLS 1.3
TLS 1.2
TLS 1.1
TLS 1.0
SSL 3.0
TLS 1.3 or higher
TLS 1.2 or higher
TLS 1.1 or higher
TLS 1.0 or higher
```

The default is `default`, which allows Chilkat to negotiate a protocol supported by both client and server. A minimum-version setting is generally more interoperable than requiring one exact version.

### Ftp2.SslServerCertVerified

`Chilkat 11.7.0 · js · Ftp2 · SslServerCertVerified · property · read-only`

```javascript
SslServerCertVerified
```

· `boolean`, `read-only`

Indicates whether the FTP server certificate chain was successfully verified for the current or most recent TLS connection.

This property reports certificate-chain verification only. It does not report hostname matching or public-key pinning. If hostname matching or `TlsPinSet` pinning is required and the check fails, the TLS connection itself fails.

### Ftp2.SyncCreateAllLocalDirs

`Chilkat 11.7.0 · js · Ftp2 · SyncCreateAllLocalDirs · property · read/write · since 9.5.0.76`

```javascript
SyncCreateAllLocalDirs
```

· `boolean`

Controls whether download synchronization creates empty remote directories on the local filesystem. The default is `true`. When `false`, a local directory is created only when it is needed to contain a downloaded file.

### Ftp2.SyncMustMatch

`Chilkat 11.7.0 · js · Ftp2 · SyncMustMatch · property · read/write`

```javascript
SyncMustMatch
```

· `string`

Specifies a semicolon-separated list of case-insensitive wildcard patterns for files that are eligible for synchronization and tree operations. For example: `*.xml;*.txt;*.csv`.

When nonempty, a file must match at least one pattern. Matching is performed against the file's basename, not its relative path. Thus `keep.txt` can match a file in any traversed subdirectory, while a pattern such as `subdir/*.txt` does not match a nested relative path.

This filter applies to synchronization methods and also to `PutTree`, `DownloadTree`, and `DirTreeXml`.

### Ftp2.SyncMustMatchDir

`Chilkat 11.7.0 · js · Ftp2 · SyncMustMatchDir · property · read/write · since 9.5.0.76`

```javascript
SyncMustMatchDir
```

· `string`

Specifies a semicolon-separated list of case-insensitive wildcard patterns for directories that synchronization methods are allowed to enter. For example: `src;data_*;reports`. When nonempty, a directory must match at least one pattern before its contents are traversed.

### Ftp2.SyncMustNotMatch

`Chilkat 11.7.0 · js · Ftp2 · SyncMustNotMatch · property · read/write`

```javascript
SyncMustNotMatch
```

· `string`

Specifies a semicolon-separated list of case-insensitive wildcard patterns for files that must be excluded from synchronization and tree operations. For example: `*.tmp;*.bak;~*`.

Matching is performed against the file's basename, not its relative path. Exclusion is applied in addition to `SyncMustMatch`.

This filter also applies to `PutTree`, `DownloadTree`, and `DirTreeXml`.

### Ftp2.SyncMustNotMatchDir

`Chilkat 11.7.0 · js · Ftp2 · SyncMustNotMatchDir · property · read/write · since 9.5.0.76`

```javascript
SyncMustNotMatchDir
```

· `string`

Specifies a semicolon-separated list of case-insensitive wildcard patterns for directories that synchronization methods must not enter. For example: `.git;temp;archive_*`. Exclusion is applied in addition to `SyncMustMatchDir`.

### Ftp2.SyncPreview

`Chilkat 11.7.0 · js · Ftp2 · SyncPreview · property · read-only`

```javascript
SyncPreview
```

· `string`, `read-only`

Contains the preview produced by `SyncRemoteTree2` when ARG4 is `true`. Each CRLF-delimited line is an absolute local path that would be uploaded if preview mode were disabled.

The value is replaced at the start of each preview operation. It is empty when no files qualify, when the preview fails, or when ARG2 is not a valid synchronization mode. A subsequent non-preview synchronization operation also clears it. Unrelated methods do not clear the most recent preview.

### Ftp2.TlsCipherSuite

`Chilkat 11.7.0 · js · Ftp2 · TlsCipherSuite · property · read-only · since 9.5.0.49`

```javascript
TlsCipherSuite
```

· `string`, `read-only`

Contains the cipher suite negotiated for the current or most recent successful TLS connection, such as `TLS_AES_256_GCM_SHA384`. It is empty before a TLS session has been established or after a failed attempt that produced no negotiated suite.

### Ftp2.TlsPinSet

`Chilkat 11.7.0 · js · Ftp2 · TlsPinSet · property · read/write · since 9.5.0.55`

```javascript
TlsPinSet
```

**Full documentation for this property (same in every language):** [Encodings Supported by Chilkat](https://www.chilkatsoft.com/ai-docs/v/11.7.0/articles/binary_encodings.md)

· `string`

Specifies one or more expected Subject Public Key Info (SPKI) fingerprints for TLS public-key pinning. If none of the configured pins matches the server certificate, the TLS handshake fails.

Pinning supplements normal certificate-chain verification; it does not replace it. A matching pin does not make an expired or otherwise invalid certificate acceptable. When a pin set is configured, pin matching is enforced even if `RequireSslCertVerify` is `false`.

The format is:

```
hashAlgorithm, encoding, fingerprint1, fingerprint2, ...
```

Example:

```
sha256, base64, lKg1SIqyhPSK19tlPbjl8s02yChsVTDklQpkMCHvsTE=
```

Supported hash algorithms include `sha1`, `sha256`, `sha384`, `sha512`, `md2`, `md5`, `haval`, `ripemd128`, `ripemd160`, `ripemd256`, and `ripemd320`. Supported encodings include `base64`, `hex`, and other Chilkat-supported binary encodings.

**FTP connection scope:** Pin matching is enforced for every TLS connection established by this object, including the FTPS control connection and all TLS-protected data connections.

### Ftp2.TlsVersion

`Chilkat 11.7.0 · js · Ftp2 · TlsVersion · property · read-only · since 9.5.0.49`

```javascript
TlsVersion
```

· `string`, `read-only`

Contains the protocol version negotiated for the current or most recent successful TLS connection, such as `TLS 1.2` or `TLS 1.3`. It is empty when no TLS session has been established.

### Ftp2.UncommonOptions

`Chilkat 11.7.0 · js · Ftp2 · UncommonOptions · property · read/write · since 9.5.0.78`

```javascript
UncommonOptions
```

· `string`

Provides a comma-separated list of compatibility options for uncommon platform or server requirements. The default is empty and should normally remain empty.

| Keyword | Effect |
| :--- | :--- |
| `OpenNonExclusive` | On Windows, opens a local download file without exclusive sharing so another process may access it while data is being written. |
| `ProtectFromVpn` | On Android, requests that FTP sockets bypass an active VPN. |
| `EnableTls13` | Compatibility switch that explicitly enables offering TLS 1.3 in builds where it is not already enabled by policy. |
| `DisableTls13` | Prevents TLS 1.3 negotiation for compatibility with a problematic peer. |
| `NoPreserveFileTime` | Leaves downloaded files with the current local time instead of attempting to preserve the remote modification time. |

**Use sparingly:** These options alter low-level behavior and may be platform-specific. Configure one only when the documented default causes a known interoperability problem.

### Ftp2.UploadTransferRate

`Chilkat 11.7.0 · js · Ftp2 · UploadTransferRate · property · read-only`

```javascript
UploadTransferRate
```

· `int`, `read-only`

Returns the current average upload rate in bytes per second. The value is updated during synchronous and asynchronous uploads and describes the upload in progress or the most recently completed upload. A subsequent download does not clear the retained upload rate.

### Ftp2.UseEpsv

`Chilkat 11.7.0 · js · Ftp2 · UseEpsv · property · read/write`

```javascript
UseEpsv
```

· `boolean`

Controls whether passive data connections first use `EPSV` instead of `PASV`. The default is `false`. This property has no effect when `Passive` is `false`.

If `EPSV` is rejected, Chilkat automatically retries the data connection using `PASV`. The rejection does not disable `EPSV` for the remainder of the session, so a later passive data connection may try `EPSV` again.

`AutoSetUseEpsv` can change this property automatically when server capabilities are examined.

**Compatibility:** `EPSV` avoids embedding an IP address in the server reply and is the passive-mode command defined for IPv6. Some legacy FTP-aware firewalls mishandle it.

### Ftp2.Username

`Chilkat 11.7.0 · js · Ftp2 · Username · property · read/write`

```javascript
Username
```

· `string`

Specifies the FTP login name. The default is `anonymous`. Set it to an empty string to have `Connect` establish the connection without performing authentication; authentication may then be handled separately with `LoginAfterConnectOnly`.

## Methods

### Ftp2.AppendFile

`Chilkat 11.7.0 · js · Ftp2 · AppendFile · method`

```javascript
var success = AppendFile(localFilePath, remoteFilePath);
```

· return: `boolean`; `true` for success, `false` for failure  
· localFilePath: `string`  
· remoteFilePath: `string`

Appends the contents of the local file at `localFilePath` to the remote file at `remoteFilePath`. Both arguments are paths in their respective local and remote filesystems.

Uses the FTP `APPE` command. On servers with normal APPE behavior, a missing remote file is created and an existing file is extended. A failed or interrupted append can leave the bytes already accepted by the server in place; the operation is not transactional.

Returns true for success, false for failure.

### Ftp2.AppendFileBd

`Chilkat 11.7.0 · js · Ftp2 · AppendFileBd · method · since 11.0.0`

```javascript
var success = AppendFileBd(remoteFilename, bd);
```

· return: `boolean`; `true` for success, `false` for failure  
· remoteFilename: `string`  
· bd: `CkBinData`

Appends the bytes in the `BinData` object `bd` to the remote file at `remoteFilename`. No text encoding or line-ending conversion is performed.

Uses the FTP `APPE` command. On servers with normal APPE behavior, a missing remote file is created and an existing file is extended. A failed or interrupted append can leave the bytes already accepted by the server in place; the operation is not transactional.

Returns true for success, false for failure.

### Ftp2.AppendFileFromTextData

`Chilkat 11.7.0 · js · Ftp2 · AppendFileFromTextData · method`

```javascript
var success = AppendFileFromTextData(remoteFilename, textData, charset);
```

· return: `boolean`; `true` for success, `false` for failure  
· remoteFilename: `string`  
· textData: `string`  
· charset: `string`

Encodes the text in `textData` using the character encoding named by `charset` and appends the resulting bytes to the remote file at `remoteFilename`.

This method controls the encoding of the file content. The encoding used for the remote filename itself is controlled separately by `CommandCharset`.

Uses the FTP `APPE` command. On servers with normal APPE behavior, a missing remote file is created and an existing file is extended. A failed or interrupted append can leave the bytes already accepted by the server in place; the operation is not transactional.

Returns true for success, false for failure.

### Ftp2.AppendFileSb

`Chilkat 11.7.0 · js · Ftp2 · AppendFileSb · method · since 11.0.0`

```javascript
var success = AppendFileSb(remoteFilename, sb, charset);
```

· return: `boolean`; `true` for success, `false` for failure  
· remoteFilename: `string`  
· sb: `CkStringBuilder`  
· charset: `string`

Encodes the text in the `StringBuilder` `sb` using the charset named by `charset` and appends the resulting bytes to the remote file at `remoteFilename`.

Uses the FTP `APPE` command. On servers with normal APPE behavior, a missing remote file is created and an existing file is extended. A failed or interrupted append can leave the bytes already accepted by the server in place; the operation is not transactional.

Returns true for success, false for failure.

### Ftp2.ChangeRemoteDir

`Chilkat 11.7.0 · js · Ftp2 · ChangeRemoteDir · method`

```javascript
var success = ChangeRemoteDir(remoteDirPath);
```

· return: `boolean`; `true` for success, `false` for failure  
· remoteDirPath: `string`

Changes the current working directory on the FTP server to `remoteDirPath`. A relative path is resolved from the current remote directory; an absolute path is interpreted according to the server's path syntax.

Chilkat sends one `CWD` command containing `remoteDirPath`. It does not split a multi-level path into separate directory changes. A server may accept a path such as `a/b/c` in one command or may require the application to change one level at a time.

If the `CWD` command fails, the current remote directory remains unchanged.

**Current directory:** Many Ftp2 methods operate relative to the current remote directory. Use `GetCurrentRemoteDir` to inspect it.

Returns true for success, false for failure.

### Ftp2.CheckConnection

`Chilkat 11.7.0 · js · Ftp2 · CheckConnection · method · since 9.5.0.44`

```javascript
var success = CheckConnection();
```

· return: `boolean`; `true` for success, `false` for failure

Returns whether Chilkat currently considers the FTP control connection to be open. It does not require that the session be authenticated: it can return `true` after `ConnectOnly` and before `LoginAfterConnectOnly`.

This is a local connection-state check. It does not send `NOOP`, reconnect automatically, or prove that a silently broken network path will carry the next command.

Returns true for success, false for failure.

### Ftp2.ClearControlChannel

`Chilkat 11.7.0 · js · Ftp2 · ClearControlChannel · method`

```javascript
var success = ClearControlChannel();
```

· return: `boolean`; `true` for success, `false` for failure

Requests that an explicit-FTPS control connection return to clear text after authentication. Data connections may remain protected according to `DataProtection`.

**Security and compatibility:** This is a legacy workaround for FTP-aware NAT devices that must inspect PORT or PASV commands. It exposes FTP commands and replies, including path names, and should not be used unless required by the network environment.

Returns true for success, false for failure.

### Ftp2.ClearDirCache

`Chilkat 11.7.0 · js · Ftp2 · ClearDirCache · method`

```javascript
ClearDirCache();
```

· return: `undefined`

Clears the cached listing for the current remote directory. The next call to `GetDirCount` or another indexed listing method retrieves a fresh listing from the server.

The cache is automatically invalidated when the current remote directory or `ListPattern` changes. Uploading, deleting, renaming, creating, or removing a remote item does not automatically refresh the cache. Changing `AllowMlsd`, `PreferNlst`, `ListOption`, or `DirListingCharset` also leaves the existing cache intact.

**After a remote change:** Call this method before relying on indexed listing methods when the application has uploaded, renamed, deleted, created, or removed an item in the current remote directory.

### Ftp2.ClearSessionLog

`Chilkat 11.7.0 · js · Ftp2 · ClearSessionLog · method`

```javascript
ClearSessionLog();
```

· return: `undefined`

Clears the in-memory FTP protocol log collected while `KeepSessionLog` is enabled.

### Ftp2.Connect

`Chilkat 11.7.0 · js · Ftp2 · Connect · method`

```javascript
var success = Connect();
```

· return: `boolean`; `true` for success, `false` for failure

Connects to the server specified by `Hostname` and `Port`, negotiates any configured proxy and TLS layer, receives the FTP greeting, and authenticates using `Username`, `Password`, and `Account`.

For implicit or explicit FTPS, TLS is established before `USER` and `PASS` are sent. Chilkat sends `PBSZ 0` and the `PROT` command required by `DataProtection`. If the server requires login before accepting those protection commands, Chilkat authenticates and retries them. Rejection of a required protection command causes the connection attempt to fail.

After login, Chilkat sets binary transfer mode with `TYPE I`, requests `SYST`, sends `FEAT` when `AutoFeat` is enabled, and may send `OPTS UTF8 ON` when UTF-8 support is advertised and `AutoOptsUtf8` is enabled. It also obtains the initial current remote directory.

Calling this method while already connected establishes a new FTP session and replaces the previous session state. The current remote directory, capability state, and listing cache are initialized for the new login.

A failed connection attempt does not leave an underlying plain FTP connection open. To separate connection establishment from authentication, call `ConnectOnly` followed by `LoginAfterConnectOnly`.

**Failure diagnosis:** After failure, inspect `ConnectFailReason`, `LastReply`, and LastErrorText. A failure before the FTP greeting is usually DNS, routing, firewall, proxy, TCP, or implicit-TLS related; a failure after the greeting may involve explicit TLS, data-protection setup, authentication, or server policy.

Returns true for success, false for failure.

### Ftp2.ConnectOnly

`Chilkat 11.7.0 · js · Ftp2 · ConnectOnly · method`

```javascript
var success = ConnectOnly();
```

· return: `boolean`; `true` for success, `false` for failure

Establishes the configured proxy and TCP connection, performs any configured implicit or explicit TLS setup, and receives the FTP server greeting, but does not send `USER` or `PASS`. Complete authentication by calling `LoginAfterConnectOnly`.

With implicit FTPS, the TLS handshake occurs immediately after the TCP connection is established and before the greeting is received. With explicit FTPS, Chilkat first receives the greeting, sends `AUTH TLS` or `AUTH SSL`, and then performs the TLS handshake. When the control channel is protected, Chilkat also sends `PBSZ 0` and the `PROT` command required by `DataProtection`, even though login has not yet occurred.

After success, `ConnectVerified` is `true` and `LoginVerified` remains `false`. The current remote directory may be unavailable until login because many servers reject `PWD` before authentication.

Returns true for success, false for failure.

### Ftp2.ConvertToTls

`Chilkat 11.7.0 · js · Ftp2 · ConvertToTls · method`

```javascript
var success = ConvertToTls();
```

· return: `boolean`; `true` for success, `false` for failure

Upgrades an already-connected clear FTP control channel to explicit TLS. This method is intended for a manually staged connection created with `ConnectOnly` while `Ssl`, `AuthTls`, and `AuthSsl` were disabled.

Chilkat sends `AUTH TLS`, performs the TLS handshake, sends `PBSZ 0`, and then sends the `PROT` command required by `DataProtection`. The method does not authenticate; call `LoginAfterConnectOnly` afterward.

Do not call it when explicit or implicit FTPS was already enabled before connecting.

Returns true for success, false for failure.

### Ftp2.CreatePlan

`Chilkat 11.7.0 · js · Ftp2 · CreatePlan · method`

```javascript
var strVal = CreatePlan(localDir);
```

· return: `string`  
· localDir: `string`

Creates and returns a textual upload plan for the local directory at `localDir`. The object must be connected because the plan records the current absolute remote directory together with the local source paths.

The generated plan contains absolute local paths and absolute remote directory operations. Treat the text as a Chilkat-generated plan for `PutPlan` rather than as a portable or stable interchange format.

The plan records what to do, not a snapshot of file contents. If a local file changes before `PutPlan` executes, the current file contents are uploaded.

**Resumable bulk upload:** `PutPlan` records completed operations in a log file. Reusing the plan and log after interruption allows already completed steps to be skipped.

Returns `null` on failure

### Ftp2.CreateRemoteDir

`Chilkat 11.7.0 · js · Ftp2 · CreateRemoteDir · method`

```javascript
var success = CreateRemoteDir(remoteDirPath);
```

· return: `boolean`; `true` for success, `false` for failure  
· remoteDirPath: `string`

Creates the remote directory at `remoteDirPath` by sending one `MKD` command. The path is interpreted relative to the current remote directory unless the server recognizes it as absolute.

Chilkat does not split a multi-level path and does not issue separate commands to create missing parent directories. Some servers create all levels from one `MKD a/b/c` command, while others require the parent directories to exist.

If the directory already exists, the server commonly returns an error. A successful call does not refresh the cached indexed listing; call `ClearDirCache` when a fresh listing is required.

Returns true for success, false for failure.

### Ftp2.DeleteMatching

`Chilkat 11.7.0 · js · Ftp2 · DeleteMatching · method`

```javascript
var intVal = DeleteMatching(remotePattern);
```

· return: `int`  
· remotePattern: `string`

Deletes files in the current remote directory whose names match the wildcard pattern in `remotePattern`. The method returns the number deleted, or `-1` if the operation fails.

Chilkat sends a server-side legacy listing request such as `LIST *.txt`, parses the returned entries, and sends `DELE` for matching files. Matching case sensitivity and wildcard behavior therefore depend on the server. Matching directories are not removed by this method.

### Ftp2.DeleteRemoteFile

`Chilkat 11.7.0 · js · Ftp2 · DeleteRemoteFile · method`

```javascript
var success = DeleteRemoteFile(remoteFilePath);
```

· return: `boolean`; `true` for success, `false` for failure  
· remoteFilePath: `string`

Deletes the remote file at `remoteFilePath`. The path may be relative to the current remote directory or absolute according to the server's path syntax.

A successful deletion does not refresh the cached indexed listing. Call `ClearDirCache` when a fresh listing is required.

Returns true for success, false for failure.

### Ftp2.DeleteTree

`Chilkat 11.7.0 · js · Ftp2 · DeleteTree · method`

```javascript
var success = DeleteTree();
```

· return: `boolean`; `true` for success, `false` for failure

Recursively deletes the files and subdirectories beneath the current remote directory. Child directories are removed after their contents are deleted, but the current root directory itself remains in place and remains the current remote directory.

**Destructive operation:** Set the current remote directory carefully before calling this method. The VerifyDeleteFile and VerifyDeleteDir callbacks can set their skip output to prevent selected items from being deleted.

Returns true for success, false for failure.

### Ftp2.DirTreeXml

`Chilkat 11.7.0 · js · Ftp2 · DirTreeXml · method`

```javascript
var strVal = DirTreeXml();
```

· return: `string`

Returns an XML representation of the complete remote directory tree rooted at the current remote directory. The result uses a `<dirTree>` root, nested `<dir name="...">` elements, and file elements containing the name, size, and available modification time.

```
<dirTree>
  <file sz="123" dt="Mon, 27 Jul 2026 06:55:00 -0500">root.txt</file>
  <dir name="subdir">
    <file sz="456" dt="...">nested.txt</file>
  </dir>
</dirTree>
```

Chilkat traverses by listing each directory and temporarily changing the server's current directory. Empty directories are included, and the original current remote directory is restored after successful traversal.

Traversal is affected by `SyncMustMatch`, `SyncMustNotMatch`, `SyncMustMatchDir`, and `SyncMustNotMatchDir`. This method retrieves metadata; it does not download file content.

Returns `null` on failure

### Ftp2.Disconnect

`Chilkat 11.7.0 · js · Ftp2 · Disconnect · method`

```javascript
var success = Disconnect();
```

· return: `boolean`; `true` for success, `false` for failure

Ends the FTP session and closes the control connection. When connected, Chilkat sends `QUIT` when possible and then closes the socket.

The method is idempotent. Calling it before a connection exists or calling it again after the session is already closed succeeds without sending another FTP command. Historical properties such as `ConnectVerified`, `LoginVerified`, `Greeting`, and `LastReply` may retain information from the completed session; use `CheckConnection` for current connection state.

Returns true for success, false for failure.

### Ftp2.DownloadTree

`Chilkat 11.7.0 · js · Ftp2 · DownloadTree · method`

```javascript
var success = DownloadTree(localRoot);
```

· return: `boolean`; `true` for success, `false` for failure  
· localRoot: `string`

Downloads all selected files and subdirectories beneath the current remote directory and recreates the tree under the local directory at `localRoot`. Existing local files are overwritten, and eligible empty remote directories are created locally.

The file and directory filters in `SyncMustMatch`, `SyncMustNotMatch`, `SyncMustMatchDir`, and `SyncMustNotMatchDir` apply. Use `SetOldestDateStr` to exclude files older than a chosen date.

**Windows filenames:** Remote names that contain characters invalid in a Windows filename are sanitized when creating the local tree. Invalid characters are replaced with underscores and trailing periods are removed. For example, `a<b>c:d|e?f*g.txt` is saved as `a_b_c_d_e_f_g.txt`. Different remote names can potentially map to the same local path.

Returns true for success, false for failure.

See also:

- [Determining Settings for FTP Data Connections](http://www.cknotes.com/?p=282)

### Ftp2.Feat

`Chilkat 11.7.0 · js · Ftp2 · Feat · method`

```javascript
var strVal = Feat();
```

· return: `string`

Sends `FEAT` and returns the server's multiline capability reply. A server may return an error when the command is unsupported or not permitted in the current session state.

A successful explicit call performs the same capability processing as automatic `FEAT`. It can update `HasModeZ`, listing-extension detection, UTF-8 handling through `AutoOptsUtf8`, and `UseEpsv` through `AutoSetUseEpsv`, even when `AutoFeat` is `false`.

Some servers permit `FEAT` before authentication and others do not.

Returns `null` on failure

### Ftp2.GetCreateTimeByNameStr

`Chilkat 11.7.0 · js · Ftp2 · GetCreateTimeByNameStr · method`

```javascript
var strVal = GetCreateTimeByNameStr(filename);
```

· return: `string`  
· filename: `string`

Returns the creation time for the file or directory named by `filename` in the current remote directory as an RFC 822 date-time string, such as `Fri, 21 Nov 1997 09:55:06 -0600`.

`filename` must be a name, not a path. Set the current remote directory first, and ensure `ListPattern` matches the name so the item is present in the cached listing.

**Creation times:** Many UNIX-like filesystems and FTP listing formats do not provide a file creation time. In that case the server or parser may report the modification time instead.

Returns `null` on failure

### Ftp2.GetCreateTimeStr

`Chilkat 11.7.0 · js · Ftp2 · GetCreateTimeStr · method`

```javascript
var strVal = GetCreateTimeStr(index);
```

· return: `string`  
· index: `int`

Returns the creation time for cached directory-listing entry `index` as an RFC 822 date-time string, such as `Fri, 21 Nov 1997 09:55:06 -0600`. `index` is a zero-based index from `0` through one less than `GetDirCount`. Creation-time availability depends on the server and listing format.

An invalid index or unavailable creation time is a method failure and sets `LastMethodSuccess` to `false`.

Returns `null` on failure

### Ftp2.GetCurrentRemoteDir

`Chilkat 11.7.0 · js · Ftp2 · GetCurrentRemoteDir · method`

```javascript
var strVal = GetCurrentRemoteDir();
```

· return: `string`

Returns the current working directory reported by the FTP server, normally by using the `PWD` command.

Returns `null` on failure

### Ftp2.GetDirCount

`Chilkat 11.7.0 · js · Ftp2 · GetDirCount · method · since 9.5.0.44`

```javascript
var intVal = GetDirCount();
```

· return: `int`

Returns the number of files and directories in the cached listing of the current remote directory after applying the case-insensitive `ListPattern`. On the first call, Chilkat obtains and caches the full directory listing and then applies the pattern locally. Repeated indexed listing calls use the cache until it is invalidated. Returns `-1` if the listing cannot be obtained or parsed.

The cache is not automatically refreshed by uploads, deletions, renames, directory creation/removal, raw commands, or changes to the listing-command selection properties. Call `ClearDirCache` when the server contents or desired listing format may have changed.

**Directory listings use a data connection:** An FTP listing is transferred over a separate data connection, just like an upload or download. If this method stalls, investigate passive/active mode, NAT, firewall rules, and the data-connection details in LastErrorText.

### Ftp2.GetFile

`Chilkat 11.7.0 · js · Ftp2 · GetFile · method`

```javascript
var success = GetFile(remoteFilePath, localFilePath);
```

· return: `boolean`; `true` for success, `false` for failure  
· remoteFilePath: `string`  
· localFilePath: `string`

Downloads the remote file at `remoteFilePath` to the local filesystem path at `localFilePath`. The local parent directory must already exist; this method does not create missing local directories.

When not resuming, the downloaded file replaces an existing destination after the server accepts the transfer. If the server rejects the request before transfer begins, such as when the remote file does not exist, an existing destination file is preserved.

Use `RestartNext` immediately before this call to resume from the existing local file length. `ReadTimeout` controls data-channel inactivity. If a transfer fails after receiving some data, inspect `PartialTransfer`; completed bytes are not rolled back.

Returns true for success, false for failure.

See also:

- [Determining Settings for FTP Data Connections](http://www.cknotes.com/?p=282)

### Ftp2.GetFileBd

`Chilkat 11.7.0 · js · Ftp2 · GetFileBd · method · since 9.5.0.62`

```javascript
var success = GetFileBd(remoteFilePath, binData);
```

· return: `boolean`; `true` for success, `false` for failure  
· remoteFilePath: `string`  
· binData: `CkBinData`

Downloads the remote file at `remoteFilePath` and appends its bytes to the existing contents of the `BinData` object in `binData`. The object is not cleared automatically. No text decoding or line-ending conversion is performed.

When `RestartNext` is `true`, the current byte count in `binData` is used as the resume offset and only the remaining remote bytes are appended.

Returns true for success, false for failure.

### Ftp2.GetFilename

`Chilkat 11.7.0 · js · Ftp2 · GetFilename · method`

```javascript
var strVal = GetFilename(index);
```

· return: `string`  
· index: `int`

Returns the name of cached directory-listing entry `index`. `index` is a zero-based index from `0` through one less than `GetDirCount`. The returned value is the name from the listing, not necessarily a full remote path.

An out-of-range or negative index is a method failure and sets `LastMethodSuccess` to `false`.

Returns `null` on failure

### Ftp2.GetFileSb

`Chilkat 11.7.0 · js · Ftp2 · GetFileSb · method · since 9.5.0.62`

```javascript
var success = GetFileSb(remoteFilePath, charset, sb);
```

· return: `boolean`; `true` for success, `false` for failure  
· remoteFilePath: `string`  
· charset: `string`  
· sb: `CkStringBuilder`

Downloads the remote file at `remoteFilePath`, decodes its bytes using the charset named by `charset`, and appends the resulting text to the existing contents of the `StringBuilder` in `sb`. The destination is not cleared automatically.

A byte-order mark for the selected encoding is recognized and removed from the decoded text. Invalid byte sequences are replaced during decoding rather than causing the transfer itself to fail.

When `RestartNext` is `true`, the existing destination content is used to determine the resume offset, and the remaining decoded content is appended.

Returns true for success, false for failure.

### Ftp2.GetGroup

`Chilkat 11.7.0 · js · Ftp2 · GetGroup · method · since 9.5.0.50`

```javascript
var strVal = GetGroup(index);
```

· return: `string`  
· index: `int`

Returns the group name or identifier for cached directory-listing entry `index`. The value is empty when the server does not provide group metadata.

**MLSD metadata:** MLSD commonly provides accurate size and time facts but often omits owner and group. On a UNIX-like server, disabling `AllowMlsd` may expose owner/group through LIST, at the cost of less standardized and potentially less accurate listing data.

Returns `null` on failure

### Ftp2.GetIsDirectory

`Chilkat 11.7.0 · js · Ftp2 · GetIsDirectory · method`

```javascript
var boolVal = GetIsDirectory(index);
```

· return: `boolean`  
· index: `int`

Returns `true` when cached directory-listing entry `index` is identified as a directory. `index` is a zero-based index into the current cached listing.

For an invalid index the method returns `false` and sets `LastMethodSuccess` to `false`. Check that property when `false` must be distinguished from a valid non-directory entry.

### Ftp2.GetIsSymbolicLink

`Chilkat 11.7.0 · js · Ftp2 · GetIsSymbolicLink · method`

```javascript
var boolVal = GetIsSymbolicLink(index);
```

· return: `boolean`  
· index: `int`

Returns `true` when cached directory-listing entry `index` is identified as a symbolic link. This information is available only when the server's listing format reports it.

For an invalid index the method returns `false` and sets `LastMethodSuccess` to `false`. A valid `false` result can also mean the entry is not a link or the listing did not provide link metadata.

### Ftp2.GetLastJsonData

`Chilkat 11.7.0 · js · Ftp2 · GetLastJsonData · method · since 11.5.0`

```javascript
GetLastJsonData(json);
```

· return: `undefined`  
· json: `CkJsonObject`

Copies structured supplemental JSON produced by the immediately preceding method into the `JsonObject` in `json`. TLS connection and protected data-connection operations can populate information such as the negotiated TLS version.

The data is transient. A later method may replace it or clear it to an empty object, including ordinary commands such as `NOOP`, raw commands, or `Disconnect`. Call this method immediately after the operation whose details are needed.

### Ftp2.GetLastModifiedTimeByNameStr

`Chilkat 11.7.0 · js · Ftp2 · GetLastModifiedTimeByNameStr · method`

```javascript
var strVal = GetLastModifiedTimeByNameStr(filename);
```

· return: `string`  
· filename: `string`

Returns the last-modified time for the item named by `filename` in the current remote directory as an RFC 822 date-time string, such as `Fri, 21 Nov 1997 09:55:06 -0600`.

`filename` must be a name, not a path. Set the current remote directory first, and ensure `ListPattern` matches the name.

Returns `null` on failure

### Ftp2.GetLastModifiedTimeStr

`Chilkat 11.7.0 · js · Ftp2 · GetLastModifiedTimeStr · method`

```javascript
var strVal = GetLastModifiedTimeStr(index);
```

· return: `string`  
· index: `int`

Returns the last-modified time for cached directory-listing entry `index` as an RFC 822 date-time string, such as `Fri, 21 Nov 1997 09:55:06 -0600`. `index` is a zero-based index into the current cached listing.

An invalid index or unavailable timestamp is a method failure and sets `LastMethodSuccess` to `false`.

Returns `null` on failure

### Ftp2.GetOwner

`Chilkat 11.7.0 · js · Ftp2 · GetOwner · method · since 9.5.0.50`

```javascript
var strVal = GetOwner(index);
```

· return: `string`  
· index: `int`

Returns the owner name or identifier for cached directory-listing entry `index`. The value is empty when a valid entry has no owner metadata. An invalid index is a method failure and sets `LastMethodSuccess` to `false`.

**MLSD metadata:** MLSD commonly provides accurate size and time facts but often omits owner and group. On a UNIX-like server, disabling `AllowMlsd` may expose owner/group through LIST, at the cost of less standardized and potentially less accurate listing data.

Returns `null` on failure

### Ftp2.GetPermissions

`Chilkat 11.7.0 · js · Ftp2 · GetPermissions · method · since 9.5.0.50`

```javascript
var strVal = GetPermissions(index);
```

· return: `string`  
· index: `int`

Returns the permissions or status string for cached directory-listing entry `index`. The value is empty when the server provides no such metadata. Use `GetPermType` to determine how to interpret the result.

| Permission type | Returned information |
| :--- | :--- |
| `mlsd` | The RFC 3659 `perm` fact. Letters describe FTP operations available to the logged-in user, such as append, create, delete, enter, list, rename, or write. |
| `unix` | A UNIX-style string such as `rwxr-xr-x`. |
| `netware` | NetWare trustee-right letters such as read, write, create, erase, modify, file scan, access control, and supervisor. |
| `openvms` | An OpenVMS protection string such as `(RWED,RWED,R,R)`. |
| `batchStatusFlags` | A fixed-position Connect:Enterprise batch-status string such as `-CR--M----`. |

**MLSD perm is not a file mode:** The MLSD perm fact describes operations the current FTP account may perform. It is not equivalent to UNIX owner/group/other permission bits.

Returns `null` on failure

### Ftp2.GetPermType

`Chilkat 11.7.0 · js · Ftp2 · GetPermType · method · since 9.5.0.50`

```javascript
var strVal = GetPermType(index);
```

· return: `string`  
· index: `int`

Returns the format identifier for the permissions string available for cached listing entry `index`. The value is empty when no permissions are available.

| Value | Format |
| :--- | :--- |
| `mlsd` | The RFC 3659 `perm` fact. |
| `unix` | A UNIX/POSIX-style mode string. |
| `netware` | NetWare trustee rights. |
| `openvms` | An OpenVMS protection string. |
| `batchStatusFlags` | Connect:Enterprise batch status flags. |

Use `GetPermissions` to obtain the corresponding value.

Returns `null` on failure

### Ftp2.GetRemoteFileTextC

`Chilkat 11.7.0 · js · Ftp2 · GetRemoteFileTextC · method`

```javascript
var strVal = GetRemoteFileTextC(remoteFilename, charset);
```

· return: `string`  
· remoteFilename: `string`  
· charset: `string`

Downloads the remote file at `remoteFilename`, decodes the bytes using the character encoding named by `charset`, and returns the text. A byte-order mark for the selected encoding is recognized and omitted from the returned text.

This method controls file-content decoding. The encoding used for the remote path itself is controlled by `CommandCharset`.

Returns `null` on failure

### Ftp2.GetRemoteFileTextData

`Chilkat 11.7.0 · js · Ftp2 · GetRemoteFileTextData · method`

```javascript
var strVal = GetRemoteFileTextData(remoteFilename);
```

· return: `string`  
· remoteFilename: `string`

Downloads the remote file at `remoteFilename` and returns its contents decoded using the ANSI character encoding. Use `GetRemoteFileTextC` when the file uses UTF-8 or another explicitly known encoding.

Returns `null` on failure

See also:

- [Determining Settings for FTP Data Connections](http://www.cknotes.com/?p=282)

### Ftp2.GetServerCert

`Chilkat 11.7.0 · js · Ftp2 · GetServerCert · method · since 11.0.0`

```javascript
var success = GetServerCert(cert);
```

· return: `boolean`; `true` for success, `false` for failure  
· cert: `CkCert`

Loads into the `Cert` object in `cert` the leaf certificate presented on the currently connected FTPS control channel.

The method requires an active TLS control connection. A protected data connection does not replace the control-channel certificate returned here, and the certificate is not retained for retrieval after `Disconnect`.

Returns true for success, false for failure.

### Ftp2.GetSize

`Chilkat 11.7.0 · js · Ftp2 · GetSize · method`

```javascript
var intVal = GetSize(index);
```

· return: `int`  
· index: `int`

Returns the size in bytes of cached directory-listing entry `index` as a 32-bit integer. Use `GetSize64` for large files.

Returns `-1` when `index` is invalid or the size is unavailable. Because this method returns an integer, do not use `LastMethodSuccess` to interpret the result.

### Ftp2.GetSize64

`Chilkat 11.7.0 · js · Ftp2 · GetSize64 · method`

```javascript
var int64val = GetSize64(index);
```

· return: `int64`  
· index: `int`

Returns the size in bytes of cached directory-listing entry `index` as a 64-bit integer. Returns `-1` when `index` is invalid or the size is unavailable.

Because this method returns an integer, do not use `LastMethodSuccess` to interpret the result.

### Ftp2.GetSizeByName

`Chilkat 11.7.0 · js · Ftp2 · GetSizeByName · method`

```javascript
var intVal = GetSizeByName(filename);
```

· return: `int`  
· filename: `string`

Returns the size in bytes of the file named by `filename` in the current remote directory as a 32-bit integer. Returns `-1` when the file is not found or the size cannot be obtained. Use `GetSizeByName64` for large files.

`filename` must be a name, not a path. Set the current remote directory first, and ensure `ListPattern` matches the name.

### Ftp2.GetSizeByName64

`Chilkat 11.7.0 · js · Ftp2 · GetSizeByName64 · method`

```javascript
var int64val = GetSizeByName64(filename);
```

· return: `int64`  
· filename: `string`

Sends a `SIZE` command for `filename` and returns the remote size in bytes as a 64-bit integer. Returns `-1` when the server rejects the command, the item is not found, or the size is unavailable.

This method does not depend on the indexed directory cache or `ListPattern`. Filename and path case sensitivity are determined by the FTP server and its filesystem.

### Ftp2.GetSizeStr

`Chilkat 11.7.0 · js · Ftp2 · GetSizeStr · method`

```javascript
var strVal = GetSizeStr(index);
```

· return: `string`  
· index: `int`

Returns the size in bytes of cached directory-listing entry `index` as a decimal string. This form avoids integer-size limits in languages without a convenient 64-bit type.

An out-of-range or negative index is a method failure and sets `LastMethodSuccess` to `false`.

Returns `null` on failure

### Ftp2.GetSizeStrByName

`Chilkat 11.7.0 · js · Ftp2 · GetSizeStrByName · method`

```javascript
var strVal = GetSizeStrByName(filename);
```

· return: `string`  
· filename: `string`

Returns the size in bytes of the file named by `filename` in the current remote directory as a decimal string. This form avoids language-specific integer limits.

`filename` must be a name, not a path. Set the current remote directory first, and ensure `ListPattern` matches the name.

Returns `null` on failure

### Ftp2.GetSyncedFiles

`Chilkat 11.7.0 · js · Ftp2 · GetSyncedFiles · method · since 10.0.0`

```javascript
GetSyncedFiles(strTable);
```

· return: `undefined`  
· strTable: `CkStringTable`

Appends to the `StringTable` in `strTable` the relative paths affected by the most recent synchronization operation. Existing entries in `strTable` are preserved.

The appended paths include files uploaded, downloaded, or deleted by `SyncDeleteRemote`, `SyncLocalDir`, `SyncLocalTree`, `SyncRemoteTree`, or `SyncRemoteTree2`. When a successful preview has no candidates, no placeholder or empty-string entry is appended.

### Ftp2.GetTextDirListing

`Chilkat 11.7.0 · js · Ftp2 · GetTextDirListing · method`

```javascript
var strVal = GetTextDirListing(pattern);
```

· return: `string`  
· pattern: `string`

Sends a legacy `LIST` request and returns the server's raw textual listing. `pattern` is appended literally as a server-side listing argument. An empty `pattern` lists the current remote directory; a value such as `*.txt` sends a command such as `LIST *.txt`.

`ListOption` is also appended literally before `pattern`. For example, `ListOption = "-a"` and `pattern` equal to `*.txt` send `LIST -a *.txt`.

This method does not use `MLSD`, `NLST`, `ListPattern`, or the indexed directory cache. Wildcard matching and case sensitivity are determined by the server. The format of `LIST` output is server-specific.

Returns `null` on failure

See also:

- [Determining Settings for FTP Data Connections](http://www.cknotes.com/?p=282)

### Ftp2.GetXmlDirListing

`Chilkat 11.7.0 · js · Ftp2 · GetXmlDirListing · method`

```javascript
var strVal = GetXmlDirListing(pattern);
```

· return: `string`  
· pattern: `string`

Retrieves a directory listing for `pattern` and returns parsed entries as an XML document rooted at `<remoteDir>`. Files are represented by `<file>` elements containing `<name>`, `<size>`, and available time elements; directories are represented by `<dir>` elements.

```
<remoteDir>
  <file>
    <name>report.txt</name>
    <size>1234</size>
    <lastModTime full="20260727-065541" ... />
  </file>
  <dir lastModTime="20260727-065542" ...>archive</dir>
</remoteDir>
```

When `pattern` is empty, Chilkat uses the normal listing selection: `MLSD` when allowed and advertised, otherwise `LIST` or `NLST` according to the listing properties. When `pattern` is nonempty, Chilkat sends `LIST pattern`, so wildcard matching and case sensitivity are server-dependent.

This method does not use or populate the indexed directory cache and `ListPattern` is not applied.

**Timestamp interpretation:** Returned last-modified values are expressed in the client's local time. `MLSD` timestamps are standardized as UTC, while legacy `LIST` timestamps may omit timezone and seconds, so exact conversion can be impossible when the server timezone is unknown.

Returns `null` on failure

See also:

- [Determining Settings for FTP Data Connections](http://www.cknotes.com/?p=282)

### Ftp2.LargeFileUpload

`Chilkat 11.7.0 · js · Ftp2 · LargeFileUpload · method · since 9.5.0.58`

```javascript
var success = LargeFileUpload(localPath, remotePath, chunkSize);
```

· return: `boolean`; `true` for success, `false` for failure  
· localPath: `string`  
· remotePath: `string`  
· chunkSize: `int`

Uploads the local file at `localPath` to the remote path at `remotePath` as a sequence of data transfers, each containing up to `chunkSize` bytes. The first chunk is sent with `STOR`, which creates or replaces `remotePath`, and each later chunk is sent with `APPE`.

This method addresses a specific FTP failure mode: during one very long data transfer, the control connection is idle and may be silently dropped by a firewall, NAT device, or server timeout. Completing the upload as multiple shorter transfers periodically uses the control channel.

`chunkSize` is the in-memory chunk size. Larger chunks reduce FTP command overhead but consume more memory and leave the control channel idle longer; smaller chunks have the opposite tradeoff. Transfer counters represent the complete source file, not only the final chunk.

**Alternative:** For ordinary large files, first consider enabling `LargeFileMeasures`. Use chunked upload when infrastructure still drops the idle control session.

Returns true for success, false for failure.

### Ftp2.LoginAfterConnectOnly

`Chilkat 11.7.0 · js · Ftp2 · LoginAfterConnectOnly · method`

```javascript
var success = LoginAfterConnectOnly();
```

· return: `boolean`; `true` for success, `false` for failure

Authenticates an FTP control connection previously established by `ConnectOnly`. Chilkat sends `USER`, `PASS`, and `ACCT` when required, then performs the normal post-login initialization such as `TYPE I`, `SYST`, capability discovery, and UTF-8 setup.

If authentication is rejected, the same connection cannot be retried by simply changing the credentials and calling this method again. Disconnect or reconnect with `ConnectOnly` before attempting another login.

Returns true for success, false for failure.

### Ftp2.MGetFiles

`Chilkat 11.7.0 · js · Ftp2 · MGetFiles · method`

```javascript
var intVal = MGetFiles(remotePattern, localDir);
```

· return: `int`  
· remotePattern: `string`  
· localDir: `string`

Downloads files in the current remote directory that match `remotePattern` into the existing local directory at `localDir`. Subdirectories are not traversed. The method returns the number of files downloaded, or `-1` on failure.

`localDir` must already exist; the method does not create it. Existing local files with matching names are replaced. Chilkat sends a server-side listing request for `remotePattern`, so wildcard matching and case sensitivity depend on the FTP server and remote filesystem.

**Windows filenames:** Remote names that contain characters invalid in a Windows filename are sanitized for the local file. Invalid characters are replaced with underscores and trailing periods are removed. For example, `a<b>c:d|e?f*g.txt` is saved as `a_b_c_d_e_f_g.txt`. Different remote names can potentially map to the same local name.

### Ftp2.MPutFiles

`Chilkat 11.7.0 · js · Ftp2 · MPutFiles · method`

```javascript
var intVal = MPutFiles(pattern);
```

· return: `int`  
· pattern: `string`

Uploads each local file matching `pattern` to the current remote directory. `pattern` may include a local directory and wildcard, such as `C:/data/*.txt`. Subdirectories are not traversed.

Local wildcard behavior follows the local operating system; for example, Windows matching is case-insensitive. Only each matching file's basename is used as the remote filename. Existing remote files are replaced using normal `STOR` behavior.

The method returns the number of files uploaded, or `-1` on failure.

### Ftp2.NlstXml

`Chilkat 11.7.0 · js · Ftp2 · NlstXml · method`

```javascript
var strVal = NlstXml(remoteDirPattern);
```

· return: `string`  
· remoteDirPattern: `string`

Sends `NLST` with `remoteDirPattern` appended literally and returns the names in XML form. An empty `remoteDirPattern` sends `NLST`; a value such as `*.txt` sends `NLST *.txt`.

```
<nlst>
  <e>name1</e>
  <e>name2</e>
</nlst>
```

The response is decoded using `DirListingCharset`. `NLST` normally returns names only; the XML does not distinguish files from directories and does not provide reliable sizes, times, ownership, or permissions. Wildcard matching and case sensitivity are server-dependent.

This method does not use or populate the indexed directory cache.

Returns `null` on failure

### Ftp2.Noop

`Chilkat 11.7.0 · js · Ftp2 · Noop · method`

```javascript
var success = Noop();
```

· return: `boolean`; `true` for success, `false` for failure

Sends the FTP `NOOP` command. The server must return a positive FTP reply for the method to succeed.

Whether `NOOP` is accepted before login is server-dependent. This method does not reconnect a closed session.

Returns true for success, false for failure.

### Ftp2.PutFile

`Chilkat 11.7.0 · js · Ftp2 · PutFile · method`

```javascript
var success = PutFile(localFilePath, remoteFilePath);
```

· return: `boolean`; `true` for success, `false` for failure  
· localFilePath: `string`  
· remoteFilePath: `string`

Uploads the local filesystem file at `localFilePath` to the remote path at `remoteFilePath`.

Uses the FTP `STOR` command. A normal upload creates a missing remote file or truncates and replaces an existing one. Chilkat does not create missing remote parent directories and does not upload through a temporary remote name followed by an atomic rename.

Use `RestartNext` immediately before this call to resume an existing partial remote file. `IdleTimeoutMs` limits how long the upload may remain blocked without forward progress.

Returns true for success, false for failure.

See also:

- [Determining Settings for FTP Data Connections](http://www.cknotes.com/?p=282)

### Ftp2.PutFileBd

`Chilkat 11.7.0 · js · Ftp2 · PutFileBd · method · since 9.5.0.62`

```javascript
var success = PutFileBd(binData, remoteFilePath);
```

· return: `boolean`; `true` for success, `false` for failure  
· binData: `CkBinData`  
· remoteFilePath: `string`

Uploads the bytes contained in the `BinData` object in `binData` to the remote path at `remoteFilePath`. No character encoding or line-ending conversion is performed.

Uses the FTP `STOR` command. A normal upload creates a missing remote file or truncates and replaces an existing one. Chilkat does not create missing remote parent directories and does not upload through a temporary remote name followed by an atomic rename.

`RestartNext` can be used to upload only the bytes beyond the existing remote size.

Returns true for success, false for failure.

### Ftp2.PutFileFromTextData

`Chilkat 11.7.0 · js · Ftp2 · PutFileFromTextData · method`

```javascript
var success = PutFileFromTextData(remoteFilename, textData, charset);
```

· return: `boolean`; `true` for success, `false` for failure  
· remoteFilename: `string`  
· textData: `string`  
· charset: `string`

Encodes the text in `textData` using the character encoding named by `charset` and uploads the resulting bytes to the remote file at `remoteFilename`.

Uses the FTP `STOR` command. A normal upload creates a missing remote file or truncates and replaces an existing one. Chilkat does not create missing remote parent directories and does not upload through a temporary remote name followed by an atomic rename.

The content charset is independent of `CommandCharset`, which controls the encoding of the remote path sent in the FTP command.

Returns true for success, false for failure.

See also:

- [Determining Settings for FTP Data Connections](http://www.cknotes.com/?p=282)

### Ftp2.PutFileSb

`Chilkat 11.7.0 · js · Ftp2 · PutFileSb · method · since 9.5.0.62`

```javascript
var success = PutFileSb(sb, charset, includeBom, remoteFilePath);
```

· return: `boolean`; `true` for success, `false` for failure  
· sb: `CkStringBuilder`  
· charset: `string`  
· includeBom: `boolean`  
· remoteFilePath: `string`

Encodes the text in the `StringBuilder` `sb` using the charset named by `charset` and uploads it to the remote path at `remoteFilePath`. When `includeBom` is `true`, a byte-order mark is included when the selected encoding defines one.

Uses the FTP `STOR` command. A normal upload creates a missing remote file or truncates and replaces an existing one. Chilkat does not create missing remote parent directories and does not upload through a temporary remote name followed by an atomic rename.

`RestartNext` can be used for a resumed upload when the existing remote content and encoded byte sequence are compatible.

Returns true for success, false for failure.

### Ftp2.PutPlan

`Chilkat 11.7.0 · js · Ftp2 · PutPlan · method`

```javascript
var success = PutPlan(plan, alreadyDoneFilename);
```

· return: `boolean`; `true` for success, `false` for failure  
· plan: `string`  
· alreadyDoneFilename: `string`

Executes the upload plan in `plan`. `alreadyDoneFilename` is the local path of a completion log; each successful plan operation is recorded there.

The absolute remote paths stored in the plan are used even if the current remote directory has changed since the plan was created. Local files are opened when this method executes, so changes made after `CreatePlan` are reflected in the upload.

To resume an interrupted plan, call this method again with the same plan and log path. Operations already recorded as complete are skipped.

**Log durability:** Store the completion log on reliable local storage and do not edit it while the plan is running.

Returns true for success, false for failure.

### Ftp2.PutTree

`Chilkat 11.7.0 · js · Ftp2 · PutTree · method`

```javascript
var success = PutTree(localDir);
```

· return: `boolean`; `true` for success, `false` for failure  
· localDir: `string`

Uploads the local directory tree rooted at `localDir` into the current remote directory, creating remote subdirectories as needed. The contents of `localDir` become children of the current remote directory.

The file and directory filters in `SyncMustMatch`, `SyncMustNotMatch`, `SyncMustMatchDir`, and `SyncMustNotMatchDir` apply. Empty eligible local directories are created remotely. Existing remote files are overwritten with `STOR`.

Returns true for success, false for failure.

### Ftp2.Quote

`Chilkat 11.7.0 · js · Ftp2 · Quote · method`

```javascript
var success = Quote(cmd);
```

· return: `boolean`; `true` for success, `false` for failure  
· cmd: `string`

Sends the raw FTP command text in `cmd` to the server. Use this for a command not otherwise exposed by the API.

`cmd` contains the command and parameters but must not contain CR or LF characters; such input is rejected without sending anything. Chilkat considers the method successful only when the server returns a positive FTP reply. A `4xx` or `5xx` reply causes failure and remains available through `LastReply`.

The method does not parse command-specific semantics. Use `SendCommand` when the reply text is needed directly.

Returns true for success, false for failure.

### Ftp2.RemoveRemoteDir

`Chilkat 11.7.0 · js · Ftp2 · RemoveRemoteDir · method`

```javascript
var success = RemoveRemoteDir(remoteDirPath);
```

· return: `boolean`; `true` for success, `false` for failure  
· remoteDirPath: `string`

Removes the remote directory at `remoteDirPath`. FTP servers generally require the directory to be empty before it can be removed.

A successful call does not refresh the cached indexed listing. Call `ClearDirCache` before relying on indexed listing methods.

Returns true for success, false for failure.

### Ftp2.RenameRemoteFile

`Chilkat 11.7.0 · js · Ftp2 · RenameRemoteFile · method`

```javascript
var success = RenameRemoteFile(existingRemoteFilePath, newRemoteFilePath);
```

· return: `boolean`; `true` for success, `false` for failure  
· existingRemoteFilePath: `string`  
· newRemoteFilePath: `string`

Renames or moves a remote file or directory from `existingRemoteFilePath` to `newRemoteFilePath` using the FTP `RNFR`/`RNTO` sequence. Include directory components in `newRemoteFilePath` to move the item within the same FTP server.

Chilkat does not perform a protective destination-existence check. If `newRemoteFilePath` already exists, one server may reject the rename while another may replace the destination. Cross-directory or cross-filesystem moves are also subject to server policy.

A successful rename does not refresh the cached indexed listing. Call `ClearDirCache` when a fresh listing is required.

Returns true for success, false for failure.

See also:

- [FTP Rename Remote File – What Happens if the Target Remote File Already Exists?](https://cknotes.com/ftp-rename-remote-file-what-happens-if-the-target-remote-file-already-exists/)

### Ftp2.SendCommand

`Chilkat 11.7.0 · js · Ftp2 · SendCommand · method`

```javascript
var strVal = SendCommand(cmd);
```

· return: `string`  
· cmd: `string`

Sends the raw FTP command in `cmd` and returns the complete server reply. The command text is sent as UTF-8; `CommandCharset` is not applied.

`cmd` must not contain CR or LF characters; such input is rejected without sending anything. A positive FTP reply is returned normally. A `4xx` or `5xx` reply is treated as method failure and sets `LastMethodSuccess` to `false`.

Returns `null` on failure

### Ftp2.SetModeZ

`Chilkat 11.7.0 · js · Ftp2 · SetModeZ · method`

```javascript
var success = SetModeZ();
```

· return: `boolean`; `true` for success, `false` for failure

Enables `MODE Z` compression for subsequent data connections. Call this after connecting and only when `HasModeZ` is `true`. Uploads, downloads, and directory listings are then transferred through a DEFLATE-compressed stream.

**Performance tradeoff:** Compression can reduce network traffic for text and other compressible data, but may increase CPU usage and provide little benefit for already-compressed formats such as ZIP, JPEG, or MP4.

Returns true for success, false for failure.

### Ftp2.SetOldestDateStr

`Chilkat 11.7.0 · js · Ftp2 · SetOldestDateStr · method`

```javascript
SetOldestDateStr(oldestDateTimeStr);
```

· return: `undefined`  
· oldestDateTimeStr: `string`

Sets the oldest remote modification time eligible for `DownloadTree`. `oldestDateTimeStr` is an RFC 822 date-time string, such as `Fri, 21 Nov 1997 09:55:06 -0600`. Files older than the configured value are skipped.

The value remains active for subsequent `DownloadTree` calls; it is not consumed after one operation. Avoid relying on exact equality at the boundary because legacy `LIST` timestamps can have reduced precision or ambiguous timezone interpretation.

### Ftp2.SetOption

`Chilkat 11.7.0 · js · Ftp2 · SetOption · method · since 9.5.0.57`

```javascript
var success = SetOption(optionName);
```

· return: `boolean`; `true` for success, `false` for failure  
· optionName: `string`

Enables or disables a named compatibility option. Option-name matching is case-insensitive. Prefix a recognized name with `No-` to disable it.

The recognized option `Microsoft-TLS-1.2-Workaround` changes data-channel TLS behavior for compatibility with an old Microsoft FTP server defect. It weakens protocol selection and should be used only for the affected legacy server. An unrecognized option name is rejected.

Returns true for success, false for failure.

### Ftp2.SetRemoteFileDateTimeStr

`Chilkat 11.7.0 · js · Ftp2 · SetRemoteFileDateTimeStr · method`

```javascript
var success = SetRemoteFileDateTimeStr(dateTimeStr, remoteFilename);
```

· return: `boolean`; `true` for success, `false` for failure  
· dateTimeStr: `string`  
· remoteFilename: `string`

Sets the last-modified time of the remote file at `remoteFilename`. `dateTimeStr` is an RFC 822 date-time string, such as `Fri, 21 Nov 1997 09:55:06 -0600`.

Chilkat converts `dateTimeStr` to UTC and sends a server-supported timestamp-setting extension. Depending on the server, the command may be `MFMT YYYYMMDDhhmmss path` or the nonstandard timestamp-setting form of `MDTM YYYYMMDDhhmmss path`. Precision is one second.

FTP has no universally implemented standard for changing a file timestamp; success depends on server extensions and permissions.

Returns true for success, false for failure.

See also:

- [Setting FTP date/time not supported by all FTP servers.](http://www.cknotes.com/?p=153)

### Ftp2.SetRemoteFileDt

`Chilkat 11.7.0 · js · Ftp2 · SetRemoteFileDt · method`

```javascript
var success = SetRemoteFileDt(dt, remoteFilename);
```

· return: `boolean`; `true` for success, `false` for failure  
· dt: `CkDateTime`  
· remoteFilename: `string`

Sets the last-modified time of the remote file at `remoteFilename` using the `CkDateTime` in `dt`.

Chilkat converts the value to UTC and sends a server-supported timestamp-setting extension. Depending on the server, the command may be `MFMT YYYYMMDDhhmmss path` or the nonstandard timestamp-setting form of `MDTM YYYYMMDDhhmmss path`. Precision is one second.

FTP has no universally implemented standard for changing a file timestamp; success depends on server extensions and permissions.

Returns true for success, false for failure.

See also:

- [Setting FTP date/time not supported by all FTP servers.](http://www.cknotes.com/?p=153)

### Ftp2.SetSecurePassword

`Chilkat 11.7.0 · js · Ftp2 · SetSecurePassword · method · since 9.5.0.76`

```javascript
var success = SetSecurePassword(password);
```

· return: `boolean`; `true` for success, `false` for failure  
· password: `CkSecureString`

Copies the password from the `SecureString` in `password` for subsequent FTP authentication. This avoids exposing the password as an ordinary immutable language string. It is equivalent to setting `Password` for login behavior.

Returns true for success, false for failure.

### Ftp2.SetSslCertRequirement

`Chilkat 11.7.0 · js · Ftp2 · SetSslCertRequirement · method`

```javascript
SetSslCertRequirement(reqName, reqValue);
```

· return: `undefined`  
· reqName: `string`  
· reqValue: `string`

Adds a required match against the FTP server certificate. `reqName` selects the certificate field and `reqValue` specifies the required value. Supported field names include `SubjectDN`, `SubjectCN`, `IssuerDN`, `IssuerCN`, and `SAN`. Wildcards such as `*` may be used in `reqValue`.

Requirement-value matching is case-sensitive. Multiple calls add requirements that are combined with logical AND; every requirement must match.

Requirements are evaluated when the FTPS control-channel TLS connection is established. Adding a new requirement after connection does not retroactively reject the existing control channel and is not applied to later protected data-channel handshakes within that session.

**Additional check:** Certificate requirements supplement normal certificate validation; they should not be used as a substitute for trust-chain, validity, and hostname verification.

### Ftp2.SetSslClientCert

`Chilkat 11.7.0 · js · Ftp2 · SetSslClientCert · method`

```javascript
var success = SetSslClientCert(cert);
```

· return: `boolean`; `true` for success, `false` for failure  
· cert: `CkCert`

Configures the `Cert` in `cert` as the client certificate for FTPS servers that request mutual TLS authentication. The certificate must have access to its private key.

Returns true for success, false for failure.

### Ftp2.SetSslClientCertPem

`Chilkat 11.7.0 · js · Ftp2 · SetSslClientCertPem · method`

```javascript
var success = SetSslClientCertPem(pemDataOrFilename, pemPassword);
```

· return: `boolean`; `true` for success, `false` for failure  
· pemDataOrFilename: `string`  
· pemPassword: `string`

Configures a client certificate and private key from PEM data or a PEM file. `pemDataOrFilename` may contain the PEM text or the local filesystem path of a PEM file. `pemPassword` is the private-key password, or an empty string when the key is not encrypted.

Returns true for success, false for failure.

### Ftp2.SetSslClientCertPfx

`Chilkat 11.7.0 · js · Ftp2 · SetSslClientCertPfx · method`

```javascript
var success = SetSslClientCertPfx(pfxFilename, pfxPassword);
```

· return: `boolean`; `true` for success, `false` for failure  
· pfxFilename: `string`  
· pfxPassword: `string`

Loads a client certificate and private key from the local PFX/P12 file at `pfxFilename`. `pfxPassword` is the file password. The certificate is used when the FTPS server requests mutual TLS authentication.

Returns true for success, false for failure.

### Ftp2.SetTypeAscii

`Chilkat 11.7.0 · js · Ftp2 · SetTypeAscii · method`

```javascript
var success = SetTypeAscii();
```

· return: `boolean`; `true` for success, `false` for failure

Sets the FTP representation type to ASCII for subsequent transfers. In ASCII mode, the FTP endpoints may translate line endings, and `CrlfMode` can apply additional conversion on downloads.

**Use carefully:** ASCII mode is intended for text. Use `SetTypeBinary` for executables, archives, images, encrypted data, and any file whose bytes must remain unchanged.

Returns true for success, false for failure.

### Ftp2.SetTypeBinary

`Chilkat 11.7.0 · js · Ftp2 · SetTypeBinary · method`

```javascript
var success = SetTypeBinary();
```

· return: `boolean`; `true` for success, `false` for failure

Sets the FTP representation type to binary (`TYPE I`) for subsequent transfers. Binary mode preserves file bytes and is the appropriate default for nearly all modern file types.

Returns true for success, false for failure.

### Ftp2.Site

`Chilkat 11.7.0 · js · Ftp2 · Site · method`

```javascript
var success = Site(siteCommand);
```

· return: `boolean`; `true` for success, `false` for failure  
· siteCommand: `string`

Sends a server-specific `SITE` command. `siteCommand` contains the text following `SITE`, for example `RECFM=FB LRECL=600`.

`SITE` subcommands are defined by the server, not by the FTP standard, and may require special permissions.

Returns true for success, false for failure.

### Ftp2.SleepMs

`Chilkat 11.7.0 · js · Ftp2 · SleepMs · method`

```javascript
SleepMs(millisec);
```

· return: `undefined`  
· millisec: `int`

Blocks the calling thread for `millisec` milliseconds. This is a utility method and performs no FTP network operation.

### Ftp2.Stat

`Chilkat 11.7.0 · js · Ftp2 · Stat · method`

```javascript
var strVal = Stat();
```

· return: `string`

Sends the FTP `STAT` command and returns the server's reply. Depending on the server and session state, the reply may contain status information or a directory listing.

Support, accepted arguments, and whether the command is permitted before login are server-dependent.

Returns `null` on failure

### Ftp2.SyncDeleteRemote

`Chilkat 11.7.0 · js · Ftp2 · SyncDeleteRemote · method`

```javascript
var success = SyncDeleteRemote(localRoot);
```

· return: `boolean`; `true` for success, `false` for failure  
· localRoot: `string`

Recursively compares the remote tree rooted at the current remote directory with the local tree rooted at `localRoot` and deletes remote files that have no corresponding local file. The synchronization file and directory filters apply. Empty remote directories are not deleted.

**Destructive synchronization:** This method deletes server data. Verify the current remote directory, local root, and synchronization filters before calling it.

Use `GetSyncedFiles` after the call to obtain the relative paths deleted.

Returns true for success, false for failure.

### Ftp2.SyncLocalDir

`Chilkat 11.7.0 · js · Ftp2 · SyncLocalDir · method`

```javascript
var success = SyncLocalDir(localRoot, mode);
```

· return: `boolean`; `true` for success, `false` for failure  
· localRoot: `string`  
· mode: `int`

Synchronizes files from the current remote directory into the local directory at `localRoot` without descending into subdirectories. `mode` selects the same download modes documented for `SyncLocalTree`.

The filters are case-insensitive and match basenames. In mode `99`, only unmatched remote files in the current directory are deleted; nested directories are not traversed and their contents are not examined. Extra local files are not deleted.

Unsupported mode values fail before an FTP command is sent. Use `GetSyncedFiles` afterward to obtain the affected relative paths.

Returns true for success, false for failure.

### Ftp2.SyncLocalTree

`Chilkat 11.7.0 · js · Ftp2 · SyncLocalTree · method`

```javascript
var success = SyncLocalTree(localRoot, mode);
```

· return: `boolean`; `true` for success, `false` for failure  
· localRoot: `string`  
· mode: `int`

Synchronizes the remote tree rooted at the current remote directory into the local directory at `localRoot`. `mode` selects which files are downloaded or deleted.

| Mode | Action |
| :--- | :--- |
| `0` | Download all selected files. |
| `1` | Download files missing locally. |
| `2` | Download files that are missing locally or newer on the server. |
| `3` | Download only files that already exist locally and are newer on the server. |
| `5` | Download files that are missing locally or have a different size. |
| `6` | Download files that are missing, have a different size, or are newer on the server. |
| `99` | Do not download; delete remote files that do not exist locally. |

The synchronization filters are case-insensitive and match file basenames rather than relative paths. A file is considered newer only when its timestamp is strictly later; equal timestamps do not qualify.

Mode `99` deletes remote files that do not exist locally; it does not delete extra local files. Only the mode values shown in the table are valid. Other values fail before any FTP command is sent. Use `GetSyncedFiles` afterward to obtain the affected relative paths.

**Mode numbers differ by direction:** The upload and download synchronization methods do not assign the same meanings to all numeric modes. Use the table for the method being called.

**Time comparison:** Newer-file modes depend on remote timestamps and local clock interpretation. Size-based modes may be more predictable when server timestamp precision is limited.

Returns true for success, false for failure.

### Ftp2.SyncRemoteTree

`Chilkat 11.7.0 · js · Ftp2 · SyncRemoteTree · method`

```javascript
var success = SyncRemoteTree(localRoot, mode);
```

· return: `boolean`; `true` for success, `false` for failure  
· localRoot: `string`  
· mode: `int`

Synchronizes the local tree rooted at `localRoot` into the current remote directory. `mode` selects which files are uploaded.

| Mode | Action |
| :--- | :--- |
| `0` | Upload all selected files. |
| `1` | Upload files missing on the server. |
| `2` | Upload files that are missing or newer locally. |
| `3` | Upload only files that already exist remotely and are newer locally. |
| `4` | Upload files that are missing or have a different size. |
| `5` | Upload files that are missing, have a different size, or are newer locally. |

The synchronization filters are case-insensitive and match file basenames rather than relative paths. A file is considered newer only when its timestamp is strictly later; equal timestamps do not qualify.

Only the mode values shown in the table are valid. Other values fail before any FTP command is sent. Use `GetSyncedFiles` afterward to obtain the relative paths uploaded.

**Mode numbers differ by direction:** The upload and download synchronization methods do not assign the same meanings to all numeric modes. Use the table for the method being called rather than reusing a mode number from a download operation.

Returns true for success, false for failure.

### Ftp2.SyncRemoteTree2

`Chilkat 11.7.0 · js · Ftp2 · SyncRemoteTree2 · method`

```javascript
var success = SyncRemoteTree2(localDirPath, mode, bDescend, bPreviewOnly);
```

· return: `boolean`; `true` for success, `false` for failure  
· localDirPath: `string`  
· mode: `int`  
· bDescend: `boolean`  
· bPreviewOnly: `boolean`

Provides the upload synchronization behavior and valid modes of `SyncRemoteTree` with traversal and preview controls. `localDirPath` is the local root, `mode` is the upload synchronization mode, `bDescend` controls whether subdirectories are traversed, and `bPreviewOnly` selects preview-only mode. File and directory filters apply in both normal and preview operation.

When `bPreviewOnly` is `true`, files are not uploaded and the absolute candidate file paths are placed in `SyncPreview`. Required remote directories may still be created during preview. If no files qualify, the preview is empty.

Unsupported mode values fail before any FTP command is sent and clear `SyncPreview`. A failed preview also leaves it empty. A subsequent non-preview synchronization clears the previous preview.

Returns true for success, false for failure.

### Ftp2.Syst

`Chilkat 11.7.0 · js · Ftp2 · Syst · method`

```javascript
var strVal = Syst();
```

· return: `string`

Sends `SYST` and returns the server's operating-system type reply. Chilkat can use this information when interpreting legacy directory listings.

Whether the command is accepted before authentication is server-dependent.

Returns `null` on failure

## Events and callbacks

This binding has no event callbacks.

## Related classes

[`BinData`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/js/classes/BinData.md), [`Cert`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/js/classes/Cert.md), [`CkDateTime`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/js/classes/CkDateTime.md), [`JsonObject`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/js/classes/JsonObject.md), [`SecureString`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/js/classes/SecureString.md), [`StringBuilder`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/js/classes/StringBuilder.md), [`StringTable`](https://www.chilkatsoft.com/ai-docs/v/11.7.0/js/classes/StringTable.md)

