---
product: Chilkat
product_version: 11.7.0
language: pascal
language_label: Lazarus Pascal
class: Upload
license: free
deprecated: false
reference_html: https://www.chilkatsoft.com/refdoc/pascal_UploadRef.html
---
# Chilkat Upload — Lazarus Pascal — v11.7.0

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

## Purpose

**Upload files with HTTP POST, form fields, headers, progress tracking, and TLS control.**

`Chilkat.Upload` sends files to a web server using HTTP POST, typically as a multipart/form-data upload. It supports one or more file references, custom form parameters, custom HTTP headers, blocking and asynchronous uploads, progress monitoring, upload throttling, Basic HTTP authentication, proxy settings, HTTPS/TLS configuration, timeout control, and inspection of the HTTP response returned by the server.

**File upload requests**

Add one or more local file references and send them to a server endpoint using HTTP POST.

**Form parameters**

Add ordinary form fields alongside file parts when the server expects metadata, tokens, IDs, or other POST parameters.

**Custom headers**

Include application-specific HTTP headers for authorization schemes, API requirements, content negotiation, or server-side routing.

**Blocking or async upload**

Use a simple blocking upload, begin an upload in the background, or use async task-based workflows where supported.

**Progress and throttling**

Monitor bytes sent, percent uploaded, current filename, upload state, and optionally throttle upload bandwidth.

**Authentication, proxy, and TLS**

Configure Basic authentication, HTTP/SOCKS proxy settings, HTTPS/TLS behavior, cipher restrictions, protocol versions, and certificate pinning.

**Common pattern:** Set the server `Hostname`, `Port`, `Ssl`, and upload `Path`, add file references with `AddFileReference`, add any form parameters or headers, then call `BlockingUpload` or start an asynchronous upload. After completion, inspect `ResponseStatus`, `ResponseHeader`, `ResponseBody`, and `LastErrorText` to determine what the server returned.

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

## Object creation, unlocking and error handling

**Create / Free**

```pascal
uses
  Chilkat.Upload;

var
  obj: TUpload;
begin
  obj := TUpload.Create;
  try
    if not obj.IsValid then
      raise Exception.Create('Failed to create a TUpload instance.');

    // ... use obj ...

  finally
    obj.Free;
  end;
end;
```

`constructor Create;`

Allocates the underlying CkUpload object and returns a new TUpload instance. Simply adding **Chilkat.Upload** to the unit's `uses` clause is enough to locate and bind to the Chilkat shared library (DLL / .so / .dylib) at runtime — no separate load step is required. Check `obj.IsValid` after calling `Create`; it is `False` if the underlying library could not be found/loaded or the object could not be allocated (for example, when unlicensed).

`destructor Destroy; override;`

Every TUpload created by calling `Create` should eventually be released by calling `.Free` (inherited from `TObject`). The destructor automatically disposes the underlying CkUpload handle. A native (unmanaged) memory leak occurs if the object is never freed.

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 Lazarus Pascal.

## 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` | `property DebugLogFilePath: string read GetDebugLogFilePath write SetDebugLogFilePath;` | 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` | `property LastErrorHtml: string read GetLastErrorHtml;` | read-only | Provides HTML-formatted information about the last called method or property. |
| `LastErrorText` | `property LastErrorText: string read GetLastErrorText;` | read-only | Provides plain text information about the last called method or property. |
| `LastErrorXml` | `property LastErrorXml: string read GetLastErrorXml;` | read-only | Provides XML-formatted information about the last called method or property. |
| `LastMethodSuccess` | `property LastMethodSuccess: Boolean read GetLastMethodSuccess write SetLastMethodSuccess;` | read/write | Indicates the success or failure of the most recent method call: `True` means success, `False` means failure. |
| `VerboseLogging` | `property VerboseLogging: Boolean read GetVerboseLogging write SetVerboseLogging;` | read/write | If set to `True`, then the contents of LastErrorText (or LastErrorXml, or LastErrorHtml) may contain more verbose information. |
| `Version` | `property Version: string read GetVersion;` | read-only | Version of the component/library, such as "10.1.0" |

## Member index

| Member | Kind | Signature |
|---|---|---|
| `AbortCurrent` | property, read/write | `property AbortCurrent: Boolean read GetAbortCurrent write SetAbortCurrent;` |
| `BandwidthThrottleUp` | property, read/write | `property BandwidthThrottleUp: Integer read GetBandwidthThrottleUp write SetBandwidthThrottleUp;` |
| `ChunkSize` | property, read/write | `property ChunkSize: Integer read GetChunkSize write SetChunkSize;` |
| `ClientIpAddress` | property, read/write | `property ClientIpAddress: string read GetClientIpAddress write SetClientIpAddress;` |
| `CurrentFilename` | property, read-only | `property CurrentFilename: string read GetCurrentFilename;` |
| `Expect100Continue` | property, read/write | `property Expect100Continue: Boolean read GetExpect100Continue write SetExpect100Continue;` |
| `HeartbeatMs` | property, read/write | `property HeartbeatMs: Integer read GetHeartbeatMs write SetHeartbeatMs;` |
| `Hostname` | property, read/write | `property Hostname: string read GetHostname write SetHostname;` |
| `IdleTimeoutMs` | property, read/write | `property IdleTimeoutMs: Integer read GetIdleTimeoutMs write SetIdleTimeoutMs;` |
| `Login` | property, read/write | `property Login: string read GetLogin write SetLogin;` |
| `NumBytesSent` | property, read-only | `property NumBytesSent: LongWord read GetNumBytesSent;` |
| `Password` | property, read/write | `property Password: string read GetPassword write SetPassword;` |
| `Path` | property, read/write | `property Path: string read GetPath write SetPath;` |
| `PercentDoneScale` | property, read/write | `property PercentDoneScale: Integer read GetPercentDoneScale write SetPercentDoneScale;` |
| `PercentUploaded` | property, read-only | `property PercentUploaded: LongWord read GetPercentUploaded;` |
| `Port` | property, read/write | `property Port: Integer read GetPort write SetPort;` |
| `PreferIpv6` | property, read/write | `property PreferIpv6: Boolean read GetPreferIpv6 write SetPreferIpv6;` |
| `ProxyDomain` | property, read/write | `property ProxyDomain: string read GetProxyDomain write SetProxyDomain;` |
| `ProxyLogin` | property, read/write | `property ProxyLogin: string read GetProxyLogin write SetProxyLogin;` |
| `ProxyPassword` | property, read/write | `property ProxyPassword: string read GetProxyPassword write SetProxyPassword;` |
| `ProxyPort` | property, read/write | `property ProxyPort: Integer read GetProxyPort write SetProxyPort;` |
| `ResponseBodyStr` | property, read-only | `property ResponseBodyStr: string read GetResponseBodyStr;` |
| `ResponseHeader` | property, read-only | `property ResponseHeader: string read GetResponseHeader;` |
| `ResponseStatus` | property, read-only | `property ResponseStatus: Integer read GetResponseStatus;` |
| `Ssl` | property, read/write | `property Ssl: Boolean read GetSsl write SetSsl;` |
| `SslAllowedCiphers` | property, read/write | `property SslAllowedCiphers: string read GetSslAllowedCiphers write SetSslAllowedCiphers;` |
| `SslProtocol` | property, read/write | `property SslProtocol: string read GetSslProtocol write SetSslProtocol;` |
| `TlsPinSet` | property, read/write | `property TlsPinSet: string read GetTlsPinSet write SetTlsPinSet;` |
| `TotalUploadSize` | property, read-only | `property TotalUploadSize: LongWord read GetTotalUploadSize;` |
| `UploadInProgress` | property, read-only | `property UploadInProgress: Boolean read GetUploadInProgress;` |
| `UploadSuccess` | property, read-only | `property UploadSuccess: Boolean read GetUploadSuccess;` |
| `AbortUpload` | method | `procedure AbortUpload;` |
| `AddCustomHeader` | method | `procedure AddCustomHeader(const name: string;     const value: string);` |
| `AddFileReference` | method | `procedure AddFileReference(const name: string;     const filename: string);` |
| `AddParam` | method | `procedure AddParam(const name: string;     const value: string);` |
| `BeginUpload` | method | `function BeginUpload: Boolean;` |
| `BlockingUpload` | method | `function BlockingUpload: Boolean;` |
| `ClearFileReferences` | method | `procedure ClearFileReferences;` |
| `ClearParams` | method | `procedure ClearParams;` |
| `LoadTaskCaller` | method | `// task is a TTask object. function LoadTaskCaller(task: TChilkatBase): Boolean;` |
| `SleepMs` | method | `procedure SleepMs(millisec: Integer);` |

## Properties

### Upload.AbortCurrent

`Chilkat 11.7.0 · pascal · Upload · AbortCurrent · property · read/write · since 9.5.0.58`

```pascal
property AbortCurrent: Boolean read GetAbortCurrent write SetAbortCurrent;
```

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

### Upload.BandwidthThrottleUp

`Chilkat 11.7.0 · pascal · Upload · BandwidthThrottleUp · property · read/write · since 9.5.0.49`

```pascal
property BandwidthThrottleUp: Integer read GetBandwidthThrottleUp write SetBandwidthThrottleUp;
```

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

### Upload.ChunkSize

`Chilkat 11.7.0 · pascal · Upload · ChunkSize · property · read/write`

```pascal
property ChunkSize: Integer read GetChunkSize write SetChunkSize;
```

The chunk size (in bytes) used by the underlying TCP/IP sockets for uploading files. The default value is 65535.

### Upload.ClientIpAddress

`Chilkat 11.7.0 · pascal · Upload · ClientIpAddress · property · read/write · since 9.5.0.49`

```pascal
property ClientIpAddress: string read GetClientIpAddress write SetClientIpAddress;
```

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

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

### Upload.CurrentFilename

`Chilkat 11.7.0 · pascal · Upload · CurrentFilename · property · read-only · since 9.5.0.90`

```pascal
property CurrentFilename: string read GetCurrentFilename;
```

The current filename being uploaded while an asynchronous upload is in progress.

### Upload.Expect100Continue

`Chilkat 11.7.0 · pascal · Upload · Expect100Continue · property · read/write`

```pascal
property Expect100Continue: Boolean read GetExpect100Continue write SetExpect100Continue;
```

When `True`, the request header will included an `Expect: 100-continue` header field. This indicates that the server should respond with an intermediate response of `100 Continue` or `417 Expectation Failed` response based on the information available in the request header. This helps avoid situations such as limits on upload sizes. It allows the server to reject the upload, and then the client can abort prior to uploading the data.

The default value of this property is `True`.

### Upload.HeartbeatMs

`Chilkat 11.7.0 · pascal · Upload · HeartbeatMs · property · read/write`

```pascal
property HeartbeatMs: Integer read GetHeartbeatMs write SetHeartbeatMs;
```

**Full documentation for this property (same in every language):** [Event Callback Examples](https://www.chilkatsoft.com/ai-docs/v/11.7.0/articles/event_callback_examples.md)

The interval in milliseconds between each `AbortCheck` event callback, which enables an application to abort certain method calls before they complete. **By default, HeartbeatMs is set to** `0`**, meaning no AbortCheck event callbacks will trigger.**

### Upload.Hostname

`Chilkat 11.7.0 · pascal · Upload · Hostname · property · read/write`

```pascal
property Hostname: string read GetHostname write SetHostname;
```

The hostname of the HTTP server that is the target of the upload. Do not include `http://` in the hostname. It can be a hostname, such as `www.chilkatsoft.com`, or an IP address, such as `168.144.70.227`.

### Upload.IdleTimeoutMs

`Chilkat 11.7.0 · pascal · Upload · IdleTimeoutMs · property · read/write`

```pascal
property IdleTimeoutMs: Integer read GetIdleTimeoutMs write SetIdleTimeoutMs;
```

A timeout in milliseconds. The default value is 30000. If the upload hangs (i.e. progress halts) for more than this time, the component will abort the upload. (It will timeout.)

### Upload.Login

`Chilkat 11.7.0 · pascal · Upload · Login · property · read/write`

```pascal
property Login: string read GetLogin write SetLogin;
```

The HTTP login for sites requiring authentication. Chilkat Upload supports Basic HTTP authentication.

### Upload.NumBytesSent

`Chilkat 11.7.0 · pascal · Upload · NumBytesSent · property · read-only`

```pascal
property NumBytesSent: LongWord read GetNumBytesSent;
```

After an upload has completed, this property contains the number of bytes sent. During asynchronous uploads, this property contains the current number of bytes sent while the upload is in progress.

### Upload.Password

`Chilkat 11.7.0 · pascal · Upload · Password · property · read/write`

```pascal
property Password: string read GetPassword write SetPassword;
```

The HTTP password for sites requiring authentication. Chilkat Upload supports Basic HTTP authentication.

### Upload.Path

`Chilkat 11.7.0 · pascal · Upload · Path · property · read/write`

```pascal
property Path: string read GetPath write SetPath;
```

The path part of the upload URL. Some examples:

desc> If the upload target (i.e. consumer) URL is: http://www.freeaspupload.net/freeaspupload/testUpload.asp, then

> Hostname = `www.freeaspupload.net` Path = `/freeaspupload/testUpload.asp`

If the upload target URL is https://www.chilkatsoft.com/cgi-bin/ConsumeUpload.exe, then

> Hostname = `www.chilkatsoft.com` Path = `/cgi-bin/ConsumeUpload.exe`

### Upload.PercentDoneScale

`Chilkat 11.7.0 · pascal · Upload · PercentDoneScale · property · read/write · since 9.5.0.49`

```pascal
property PercentDoneScale: Integer read GetPercentDoneScale write SetPercentDoneScale;
```

This property is only valid in programming environment and languages that allow for event callbacks.

Sets the value to be defined as 100% complete for the purpose of PercentDone event callbacks. The defaut value of 100 means that at most 100 event PercentDone callbacks will occur in a method that (1) is event enabled and (2) is such that it is possible to measure progress as a percentage completed. This property may be set to larger numbers to get more fine-grained PercentDone callbacks. For example, setting this property equal to 1000 will provide callbacks with .1 percent granularity. For example, a value of 453 would indicate 45.3% competed. This property is clamped to a minimum value of 10, and a maximum value of 100000.

### Upload.PercentUploaded

`Chilkat 11.7.0 · pascal · Upload · PercentUploaded · property · read-only`

```pascal
property PercentUploaded: LongWord read GetPercentUploaded;
```

Contains the current percentage completion (0 to 100) while an asynchronous upload is in progress.

### Upload.Port

`Chilkat 11.7.0 · pascal · Upload · Port · property · read/write`

```pascal
property Port: Integer read GetPort write SetPort;
```

The port number of the upload target (i.e. consumer) URL. The default value is 80. If SSL is used, this should be set to 443 (typically).

### Upload.PreferIpv6

`Chilkat 11.7.0 · pascal · Upload · PreferIpv6 · property · read/write`

```pascal
property PreferIpv6: Boolean read GetPreferIpv6 write SetPreferIpv6;
```

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

### Upload.ProxyDomain

`Chilkat 11.7.0 · pascal · Upload · ProxyDomain · property · read/write`

```pascal
property ProxyDomain: string read GetProxyDomain write SetProxyDomain;
```

The domain name of a proxy host if an HTTP proxy is used. Do not include the `http://`. The domain name may be a hostname, such as `www.chilkatsoft.com`, or an IP address, such as `168.144.70.227`.

### Upload.ProxyLogin

`Chilkat 11.7.0 · pascal · Upload · ProxyLogin · property · read/write`

```pascal
property ProxyLogin: string read GetProxyLogin write SetProxyLogin;
```

If an HTTP proxy is used and it requires authentication, this property specifies the HTTP proxy login.

### Upload.ProxyPassword

`Chilkat 11.7.0 · pascal · Upload · ProxyPassword · property · read/write`

```pascal
property ProxyPassword: string read GetProxyPassword write SetProxyPassword;
```

If an HTTP proxy is used and it requires authentication, this property specifies the HTTP proxy password.

### Upload.ProxyPort

`Chilkat 11.7.0 · pascal · Upload · ProxyPort · property · read/write`

```pascal
property ProxyPort: Integer read GetProxyPort write SetProxyPort;
```

The port number of a proxy server if an HTTP proxy is used.

### Upload.ResponseBodyStr

`Chilkat 11.7.0 · pascal · Upload · ResponseBodyStr · property · read-only · since 9.5.0.83`

```pascal
property ResponseBodyStr: string read GetResponseBodyStr;
```

Returns the response body as a string.

### Upload.ResponseHeader

`Chilkat 11.7.0 · pascal · Upload · ResponseHeader · property · read-only`

```pascal
property ResponseHeader: string read GetResponseHeader;
```

An HTTP upload is nothing more than an HTTP POST that contains the content of the files being uploaded. Just as with any HTTP POST or GET, the server should send an HTTP response that consists of header and body.

desc>This property contains the header part of the HTTP response.

### Upload.ResponseStatus

`Chilkat 11.7.0 · pascal · Upload · ResponseStatus · property · read-only`

```pascal
property ResponseStatus: Integer read GetResponseStatus;
```

The HTTP response status code of the HTTP response. A list of HTTP status codes can be found here: [HTTP Response Status Codes](http://en.wikipedia.org/wiki/List_of_HTTP_status_codes).

### Upload.Ssl

`Chilkat 11.7.0 · pascal · Upload · Ssl · property · read/write`

```pascal
property Ssl: Boolean read GetSsl write SetSsl;
```

Set this to `True` if the upload is to HTTPS. For example, if the target of the upload is:

> **https://www.myuploadtarget.com/consumeUpload.asp**

desc>then set:

> Ssl = `True`  
> Hostname = `www.myuploadtarget.com`  
> Path = `/consumeupload.asp`  
> Port = 443

### Upload.SslAllowedCiphers

`Chilkat 11.7.0 · pascal · Upload · SslAllowedCiphers · property · read/write · since 9.5.0.55`

```pascal
property SslAllowedCiphers: string read GetSslAllowedCiphers write SetSslAllowedCiphers;
```

Provides a means for setting a list of ciphers that are allowed for SSL/TLS connections. The default (empty string) indicates that all implemented ciphers are possible. The TLS ciphers supported in Chilkat v9.5.0.55 and later are:

```
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256
TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256
TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA
TLS_DHE_RSA_WITH_AES_256_CBC_SHA256
TLS_DHE_RSA_WITH_AES_256_GCM_SHA384
TLS_DHE_RSA_WITH_AES_256_CBC_SHA
TLS_RSA_WITH_AES_256_CBC_SHA256
TLS_RSA_WITH_AES_256_GCM_SHA384
TLS_RSA_WITH_AES_256_CBC_SHA
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA
TLS_DHE_RSA_WITH_AES_128_CBC_SHA256
TLS_DHE_RSA_WITH_AES_128_GCM_SHA256
TLS_DHE_RSA_WITH_AES_128_CBC_SHA
TLS_RSA_WITH_AES_128_CBC_SHA256
TLS_RSA_WITH_AES_128_GCM_SHA256
TLS_RSA_WITH_AES_128_CBC_SHA
TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA
TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA
TLS_RSA_WITH_3DES_EDE_CBC_SHA
TLS_ECDHE_RSA_WITH_RC4_128_SHA
TLS_RSA_WITH_RC4_128_SHA
TLS_RSA_WITH_RC4_128_MD5
TLS_DHE_RSA_WITH_DES_CBC_SHA
TLS_RSA_WITH_DES_CBC_SHA
```

To restrict SSL/TLS connections to one or more specific ciphers, set this property to a comma-separated list of ciphers such as `TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384, TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384`. The order should be in terms of preference, with the preferred algorithms listed first. (Note that the client cannot specifically choose the algorithm is picked because it is the server that chooses. The client simply provides the server with a list from which to choose.)

The property can also disallow connections with servers having certificates with RSA keys less than a certain size. By default, server certificates having RSA keys of 512 bits or greater are allowed. Add the keyword `rsa1024` to disallow connections with servers having keys smaller than 1024 bits. Add the keyword `rsa2048` to disallow connections with servers having keys smaller than 2048 bits.

**Note:** Prior to Chilkat v9.5.0.55, it was not possible to explicitly list allowed cipher suites. The deprecated means for indicating allowed ciphers was both incomplete and unprecise. For example, the following keywords could be listed to allow matching ciphers: `aes256-cbc`, `aes128-cbc`, `3des-cbc`, and `rc4`. These keywords will still be recognized, but programs should be updated to explicitly list the allowed ciphers.

**secure-renegotiation:** Starting in Chilkat v9.5.0.55, the keyword `secure-renegotiation` may be added to require that all renegotions be done securely (as per RFC 5746).

**best-practices:** Starting in Chilkat v9.5.0.55, this property may be set to the single keyword `best-practices`. This will allow ciphers based on the current best practices. As new versions of Chilkat are released, the best practices may change. Changes will be noted here. The current best practices are:

- If the server uses an RSA key, it must be 1024 bits or greater.
- All renegotations must be secure renegotiations.
- All ciphers using RC4, DES, or 3DES are disallowed.

**Example:** The following string would restrict to 2 specific cipher suites, require RSA keys to be 1024 bits or greater, and require secure renegotiations: `TLS_DHE_RSA_WITH_AES_256_CBC_SHA256, TLS_RSA_WITH_AES_256_CBC_SHA, rsa1024, secure-renegotiation`

### Upload.SslProtocol

`Chilkat 11.7.0 · pascal · Upload · SslProtocol · property · read/write · since 9.5.0.55`

```pascal
property SslProtocol: string read GetSslProtocol write SetSslProtocol;
```

Selects the secure protocol to be used for secure (SSL/TLS) connections. Possible values are:

> 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 value is `default` which will choose the, which allows for the protocol to be selected dynamically at runtime based on the requirements of the server. Choosing an exact protocol will cause the connection to fail unless that exact protocol is negotiated. It is better to choose `X or higher` than an exact protocol. The `default` is effectively `SSL 3.0 or higher`.

### Upload.TlsPinSet

`Chilkat 11.7.0 · pascal · Upload · TlsPinSet · property · read/write · since 9.5.0.55`

```pascal
property TlsPinSet: string read GetTlsPinSet write SetTlsPinSet;
```

**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)

Specifies a set of pins for Public Key Pinning for TLS connections. This property lists the expected SPKI fingerprints for the server certificates. If the server's certificate (sent during the TLS handshake) does not match any of the SPKI fingerprints, then the TLS handshake is aborted and the connection fails. The format of this string property is as follows:

```
hash_algorithm, encoding, SPKI_fingerprint_1, SPKI_fingerprint_2, ...
```

For example, the following string specifies a single sha256 base64-encoded SPKI fingerprint:

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

This example specifies two SPKI fingerprints:

```
"sha256, base64, 4t37LpnGmrMEAG8HEz9yIrnvJV2euVRwCLb9EH5WZyI=, 68b0G5iqMvWVWvUCjMuhLEyekM5729PadtnU5tdXZKs="
```

Any of the following hash algorithms are allowed:.sha1, sha256, sha384, sha512, md2, md5, haval, ripemd128, ripemd160,ripemd256, or ripemd320.

The following encodings are allowed: base64, hex, and any of the encodings indicated in the link below.

### Upload.TotalUploadSize

`Chilkat 11.7.0 · pascal · Upload · TotalUploadSize · property · read-only`

```pascal
property TotalUploadSize: LongWord read GetTotalUploadSize;
```

The total size of the upload (in bytes). This property will become set at the beginning of an asynchronous upload. A program may monitor asynchronous uploads by tracking both NumBytesSent and PercentUploaded.

desc> This property is also set during synchronous uploads.

### Upload.UploadInProgress

`Chilkat 11.7.0 · pascal · Upload · UploadInProgress · property · read-only`

```pascal
property UploadInProgress: Boolean read GetUploadInProgress;
```

Set to `True` when an asynchronous upload is started. When the asynchronous upload is complete, this property becomes equal to `False`. A program will typically begin an asynchronous upload by calling BeginUpload, and then periodically checking the value of this property to determine when the upload is complete.

### Upload.UploadSuccess

`Chilkat 11.7.0 · pascal · Upload · UploadSuccess · property · read-only`

```pascal
property UploadSuccess: Boolean read GetUploadSuccess;
```

Set to `True` (success) or `False` (failed) after an asynchronous upload completes or aborts due to failure. When a program does an asynchronous upload, it will wait until UploadInProgress becomes `False`. It will then check the value of this property to determine if the upload was successful or not.

## Methods

### Upload.AbortUpload

`Chilkat 11.7.0 · pascal · Upload · AbortUpload · method`

```pascal
procedure AbortUpload;
```

May be called during an asynchronous upload to abort.

### Upload.AddCustomHeader

`Chilkat 11.7.0 · pascal · Upload · AddCustomHeader · method`

```pascal
procedure AddCustomHeader(const name: string;
    const value: string);
```

Adds a custom HTTP header to the HTTP upload.

### Upload.AddFileReference

`Chilkat 11.7.0 · pascal · Upload · AddFileReference · method`

```pascal
procedure AddFileReference(const name: string;
    const filename: string);
```

Adds a file to the list of files to be uploaded in the next call to BlockingUpload, BeginUpload, or UploadToMemory. To upload more than one file, call this method once for each file to be uploaded.

### Upload.AddParam

`Chilkat 11.7.0 · pascal · Upload · AddParam · method`

```pascal
procedure AddParam(const name: string;
    const value: string);
```

Adds a custom HTTP request parameter to the upload.

### Upload.BeginUpload

`Chilkat 11.7.0 · pascal · Upload · BeginUpload · method`

```pascal
function  BeginUpload: Boolean;
```

Starts an asynchronous upload. Only one asynchronous upload may be in progress at a time. To achieve multiple asynchronous uploads, use multiple instances of the Chilkat Upload object. Each object instance is capable of managing a single asynchronous upload.

desc> When this method is called, a background thread is started and the asynchronous upload runs in the background. The upload may be aborted at any time by calling AbortUpload. The upload is completed (or failed) when UploadInProgress becomes `False`. At that point, the UploadSuccess property may be checked to determine success (`True`) or failure (`False`).

Returns True for success, False for failure.

See also:

- [Debugging HTTP Upload](http://www.cknotes.com/?p=138)

### Upload.BlockingUpload

`Chilkat 11.7.0 · pascal · Upload · BlockingUpload · method`

```pascal
function  BlockingUpload: Boolean;
```

Uploads files to a web server using HTTP. The files to be uploaded are indicated by calling AddFileReference once for each file (prior to calling this method).

Returns True for success, False for failure.

See also:

- [Debugging HTTP Upload](http://www.cknotes.com/?p=138)
- [IIS 7.0 Upload Size Limitations](http://www.cknotes.com/?p=100)
- [IIS 6.0 Upload Size Limitations](http://www.cknotes.com/?p=136)

### Upload.ClearFileReferences

`Chilkat 11.7.0 · pascal · Upload · ClearFileReferences · method`

```pascal
procedure ClearFileReferences;
```

Clears the internal list of files created by calls to AddFileReference.

### Upload.ClearParams

`Chilkat 11.7.0 · pascal · Upload · ClearParams · method`

```pascal
procedure ClearParams;
```

Clears the internal list of params created by calls to AddParam.

### Upload.LoadTaskCaller

`Chilkat 11.7.0 · pascal · Upload · LoadTaskCaller · method · since 9.5.0.80`

```pascal
// task is a TTask object.

function  LoadTaskCaller(task: TChilkatBase): Boolean;
```

Loads the caller of the task's async method.

Returns True for success, False for failure.

### Upload.SleepMs

`Chilkat 11.7.0 · pascal · Upload · SleepMs · method`

```pascal
procedure SleepMs(millisec: Integer);
```

A convenience method for putting the calling process to sleep for N milliseconds. It is provided here because some programming languages do not provide this capability, and sleeping for short increments of time is helpful when doing asynchronous uploads.

## Events and callbacks

Chilkat for Pascal supports three synchronous event callbacks: `OnAbortCheck`, `OnPercentDone`, and `OnProgressInfo`. Each is a property of the class; assign a method of one of your own objects (an *of object* handler) to receive the callbacks, or assign `nil` to unhook. The handler types are declared in the `Chilkat.Base` unit:

```pascal
TChilkatAbortCheckEvent   = function(Sender: TChilkatBase): Boolean of object;
TChilkatPercentDoneEvent  = function(Sender: TChilkatBase; PctDone: Integer): Boolean of object;
TChilkatProgressInfoEvent = procedure(Sender: TChilkatBase; const Name, Value: string) of object;
```

All Chilkat methods are synchronous, so callbacks are invoked on the thread that called the method -- if the method was called from the main thread, it is safe to access UI elements from the handler. The `HeartbeatMs` property controls the frequency of `OnAbortCheck` callbacks (the default of 0 means no AbortCheck events fire). Returning `True` from an `OnAbortCheck` or `OnPercentDone` handler aborts the running method.

### Upload.AbortCheck (event)

`Chilkat 11.7.0 · pascal · Upload · AbortCheck · event`

```pascal
// TChilkatAbortCheckEvent = function(Sender: TChilkatBase): Boolean of object;

property OnAbortCheck: TChilkatAbortCheckEvent;
```

Enables a method call to be aborted by triggering the AbortCheck event at intervals defined by the `HeartbeatMs` property. If HeartbeatMs is set to its default value of 0, no events will occur. For instance, set HeartbeatMs to 200 to trigger 5 AbortCheck events per second.

**Event callback implementation:**

```pascal
// A handler is a method of one of your own classes, e.g. a form:
function TMyObject.UploadAbortCheck(Sender: TChilkatBase): Boolean;
begin
  // Called every HeartbeatMs milliseconds while a method is running.
  // Return True to abort the method; return False to continue.
  Result := False;
end;
```

**To add an event handler:**

```pascal
upload := TUpload.Create;
upload.HeartbeatMs := 250;   // fire OnAbortCheck 4 times per second
upload.OnAbortCheck := MyObject.UploadAbortCheck;
```

### Upload.PercentDone (event)

`Chilkat 11.7.0 · pascal · Upload · PercentDone · event`

```pascal
// TChilkatPercentDoneEvent = function(Sender: TChilkatBase; PctDone: Integer): Boolean of object;

property OnPercentDone: TChilkatPercentDoneEvent;
```

This provides the percentage completion for any method involving network communications or time-consuming processing, assuming the progress can be measured as a percentage. This event is triggered only when it's possible and logical to express the operation's progress as a percentage. The `pctDone` argument will range from 1 to 100. For methods that finish quickly, the number of PercentDone callbacks may vary, but the final callback will have `pctDone` equal to 100. For longer operations, callbacks will not exceed one per percentage point (e.g., 1, 2, 3, ..., 98, 99, 100).

The PercentDone callback also acts as an `AbortCheck` event. For fast methods where PercentDone fires, an AbortCheck event may not trigger since the PercentDone callback already provides an opportunity to abort. For longer operations, where time between PercentDone callbacks is extended, AbortCheck callbacks enable more responsive operation termination.

To abort the operation, set the `abort` output argument to `True`. This will cause the method to terminate and return a failure status or corresponding failure value.

**Event callback implementation:**

```pascal
// A handler is a method of one of your own classes, e.g. a form:
function TMyObject.UploadPercentDone(Sender: TChilkatBase; PctDone: Integer): Boolean;
begin
  // PctDone ranges from 1 to 100.
  WriteLn('Percent done: ', PctDone);
  // Return True to abort the method; return False to continue.
  Result := False;
end;
```

**To add an event handler:**

```pascal
upload := TUpload.Create;
upload.OnPercentDone := MyObject.UploadPercentDone;
```

### Upload.ProgressInfo (event)

`Chilkat 11.7.0 · pascal · Upload · ProgressInfo · event`

```pascal
// TChilkatProgressInfoEvent = procedure(Sender: TChilkatBase; const Name, Value: string) of object;

property OnProgressInfo: TChilkatProgressInfoEvent;
```

This event callback provides `tag name`/value pairs that detail what occurs during a method call. To discover existing tag names, create code to handle the event, emit the pairs, and review them. Most tag names are self-explanatory.

Note: Some Chilkat methods don't fire any ProgressInfo events.

**Event callback implementation:**

```pascal
// A handler is a method of one of your own classes, e.g. a form:
procedure TMyObject.UploadProgressInfo(Sender: TChilkatBase; const Name, Value: string);
begin
  WriteLn(Name, ': ', Value);
end;
```

**To add an event handler:**

```pascal
upload := TUpload.Create;
upload.OnProgressInfo := MyObject.UploadProgressInfo;
```

