Upload Delphi DLL Reference Documentation

Upload

Current Version: 10.1.0

This is a class to upload files over HTTP and HTTPS to a web server.

  • Supports both HTTP and HTTPS protocols.
  • Progress monitoring with percentage completion and "heartbeat" monitoring.
  • Abort capability.
  • Asynchronous uploads with real-time monitoring of percentage completion and number of bytes transferred.
  • Add arbitrary HTTP POST form parameters to your upload.
  • Upload multiple files in a single transaction.
  • Add arbitrary (custom) HTTP header fields to the HTTP upload.
  • Retrieve the HTTP response status, header, and body returned by the web server.

Create/Dispose

var
myObject: HCkUpload;

begin
myObject := CkUpload_Create();

// ...

CkUpload_Dispose(myObject);
end;
function CkUpload_Create: HCkUpload; stdcall;

Creates an instance of the HCkUpload object and returns a handle (i.e. a Pointer). The handle is passed in the 1st argument for the functions listed on this page.

procedure CkUpload_Dispose(handle: HCkUpload); stdcall;

Objects created by calling CkUpload_Create must be freed by calling this method. A memory leak occurs if a handle is not disposed by calling this function.

Properties

AbortCurrent
function CkUpload_getAbortCurrent(objHandle: HCkUpload): wordbool; stdcall;
procedure CkUpload_putAbortCurrent(objHandle: HCkUpload; newPropVal: wordbool); stdcall;
Introduced in version 9.5.0.58

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

top
BandwidthThrottleUp
function CkUpload_getBandwidthThrottleUp(objHandle: HCkUpload): Integer; stdcall;
procedure CkUpload_putBandwidthThrottleUp(objHandle: HCkUpload; newPropVal: Integer); stdcall;
Introduced in version 9.5.0.49

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

More Information and Examples
top
ChunkSize
function CkUpload_getChunkSize(objHandle: HCkUpload): Integer; stdcall;
procedure CkUpload_putChunkSize(objHandle: HCkUpload; newPropVal: Integer); stdcall;

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

top
ClientIpAddress
procedure CkUpload_getClientIpAddress(objHandle: HCkUpload; outPropVal: HCkString); stdcall;
procedure CkUpload_putClientIpAddress(objHandle: HCkUpload; newPropVal: PWideChar); stdcall;
function CkUpload__clientIpAddress(objHandle: HCkUpload): PWideChar; stdcall;
Introduced in version 9.5.0.49

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".

See the notes about PWideChar memory ownership and validity.

top
CurrentFilename
procedure CkUpload_getCurrentFilename(objHandle: HCkUpload; outPropVal: HCkString); stdcall;
function CkUpload__currentFilename(objHandle: HCkUpload): PWideChar; stdcall;
Introduced in version 9.5.0.90

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

See the notes about PWideChar memory ownership and validity.

top
DebugLogFilePath
procedure CkUpload_getDebugLogFilePath(objHandle: HCkUpload; outPropVal: HCkString); stdcall;
procedure CkUpload_putDebugLogFilePath(objHandle: HCkUpload; newPropVal: PWideChar); stdcall;
function CkUpload__debugLogFilePath(objHandle: HCkUpload): PWideChar; stdcall;

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

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

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

See the notes about PWideChar memory ownership and validity.

More Information and Examples
top
Expect100Continue
function CkUpload_getExpect100Continue(objHandle: HCkUpload): wordbool; stdcall;
procedure CkUpload_putExpect100Continue(objHandle: HCkUpload; newPropVal: wordbool); stdcall;

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.

top
HeartbeatMs
function CkUpload_getHeartbeatMs(objHandle: HCkUpload): Integer; stdcall;
procedure CkUpload_putHeartbeatMs(objHandle: HCkUpload; newPropVal: Integer); stdcall;

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

Specifies the time interval in milliseconds between AbortCheck events. An Upload operation can be aborted via the AbortCheck event.

top
Hostname
procedure CkUpload_getHostname(objHandle: HCkUpload; outPropVal: HCkString); stdcall;
procedure CkUpload_putHostname(objHandle: HCkUpload; newPropVal: PWideChar); stdcall;
function CkUpload__hostname(objHandle: HCkUpload): PWideChar; stdcall;

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".

See the notes about PWideChar memory ownership and validity.

top
IdleTimeoutMs
function CkUpload_getIdleTimeoutMs(objHandle: HCkUpload): Integer; stdcall;
procedure CkUpload_putIdleTimeoutMs(objHandle: HCkUpload; newPropVal: Integer); stdcall;

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

top
LastErrorHtml
procedure CkUpload_getLastErrorHtml(objHandle: HCkUpload; outPropVal: HCkString); stdcall;
function CkUpload__lastErrorHtml(objHandle: HCkUpload): PWideChar; stdcall;

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

See the notes about PWideChar memory ownership and validity.

top
LastErrorText
procedure CkUpload_getLastErrorText(objHandle: HCkUpload; outPropVal: HCkString); stdcall;
function CkUpload__lastErrorText(objHandle: HCkUpload): PWideChar; stdcall;

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

See the notes about PWideChar memory ownership and validity.

top
LastErrorXml
procedure CkUpload_getLastErrorXml(objHandle: HCkUpload; outPropVal: HCkString); stdcall;
function CkUpload__lastErrorXml(objHandle: HCkUpload): PWideChar; stdcall;

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

See the notes about PWideChar memory ownership and validity.

top
LastMethodSuccess
function CkUpload_getLastMethodSuccess(objHandle: HCkUpload): wordbool; stdcall;
procedure CkUpload_putLastMethodSuccess(objHandle: HCkUpload; newPropVal: wordbool); stdcall;

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

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

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

top
Login
procedure CkUpload_getLogin(objHandle: HCkUpload; outPropVal: HCkString); stdcall;
procedure CkUpload_putLogin(objHandle: HCkUpload; newPropVal: PWideChar); stdcall;
function CkUpload__login(objHandle: HCkUpload): PWideChar; stdcall;

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

See the notes about PWideChar memory ownership and validity.

top
NumBytesSent
function CkUpload_getNumBytesSent(objHandle: HCkUpload): LongWord; stdcall;

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.

top
Password
procedure CkUpload_getPassword(objHandle: HCkUpload; outPropVal: HCkString); stdcall;
procedure CkUpload_putPassword(objHandle: HCkUpload; newPropVal: PWideChar); stdcall;
function CkUpload__password(objHandle: HCkUpload): PWideChar; stdcall;

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

See the notes about PWideChar memory ownership and validity.

top
Path
procedure CkUpload_getPath(objHandle: HCkUpload; outPropVal: HCkString); stdcall;
procedure CkUpload_putPath(objHandle: HCkUpload; newPropVal: PWideChar); stdcall;
function CkUpload__path(objHandle: HCkUpload): PWideChar; stdcall;

The path part of the upload URL. Some examples:

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"

See the notes about PWideChar memory ownership and validity.

top
PercentDoneScale
function CkUpload_getPercentDoneScale(objHandle: HCkUpload): Integer; stdcall;
procedure CkUpload_putPercentDoneScale(objHandle: HCkUpload; newPropVal: Integer); stdcall;
Introduced in version 9.5.0.49

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.

top
PercentUploaded
function CkUpload_getPercentUploaded(objHandle: HCkUpload): LongWord; stdcall;

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

top
Port
function CkUpload_getPort(objHandle: HCkUpload): Integer; stdcall;
procedure CkUpload_putPort(objHandle: HCkUpload; newPropVal: Integer); stdcall;

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

top
PreferIpv6
function CkUpload_getPreferIpv6(objHandle: HCkUpload): wordbool; stdcall;
procedure CkUpload_putPreferIpv6(objHandle: HCkUpload; newPropVal: wordbool); stdcall;

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.

top
ProxyDomain
procedure CkUpload_getProxyDomain(objHandle: HCkUpload; outPropVal: HCkString); stdcall;
procedure CkUpload_putProxyDomain(objHandle: HCkUpload; newPropVal: PWideChar); stdcall;
function CkUpload__proxyDomain(objHandle: HCkUpload): PWideChar; stdcall;

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".

See the notes about PWideChar memory ownership and validity.

top
ProxyLogin
procedure CkUpload_getProxyLogin(objHandle: HCkUpload; outPropVal: HCkString); stdcall;
procedure CkUpload_putProxyLogin(objHandle: HCkUpload; newPropVal: PWideChar); stdcall;
function CkUpload__proxyLogin(objHandle: HCkUpload): PWideChar; stdcall;

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

See the notes about PWideChar memory ownership and validity.

top
ProxyPassword
procedure CkUpload_getProxyPassword(objHandle: HCkUpload; outPropVal: HCkString); stdcall;
procedure CkUpload_putProxyPassword(objHandle: HCkUpload; newPropVal: PWideChar); stdcall;
function CkUpload__proxyPassword(objHandle: HCkUpload): PWideChar; stdcall;

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

See the notes about PWideChar memory ownership and validity.

top
ProxyPort
function CkUpload_getProxyPort(objHandle: HCkUpload): Integer; stdcall;
procedure CkUpload_putProxyPort(objHandle: HCkUpload; newPropVal: Integer); stdcall;

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

top
ResponseBody
procedure CkUpload_getResponseBody(objHandle: HCkUpload; outPropVal: HCkByteData); stdcall;

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.

This property contains the body part of the HTTP response.

top
ResponseBodyStr
procedure CkUpload_getResponseBodyStr(objHandle: HCkUpload; outPropVal: HCkString); stdcall;
function CkUpload__responseBodyStr(objHandle: HCkUpload): PWideChar; stdcall;
Introduced in version 9.5.0.83

Returns the response body as a string.

See the notes about PWideChar memory ownership and validity.

top
ResponseHeader
procedure CkUpload_getResponseHeader(objHandle: HCkUpload; outPropVal: HCkString); stdcall;
function CkUpload__responseHeader(objHandle: HCkUpload): PWideChar; stdcall;

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.

This property contains the header part of the HTTP response.

See the notes about PWideChar memory ownership and validity.

top
ResponseStatus
function CkUpload_getResponseStatus(objHandle: HCkUpload): Integer; stdcall;

The HTTP response status code of the HTTP response. A list of HTTP status codes can be found here: HTTP Response Status Codes.

top
Ssl
function CkUpload_getSsl(objHandle: HCkUpload): wordbool; stdcall;
procedure CkUpload_putSsl(objHandle: HCkUpload; newPropVal: wordbool); stdcall;

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

then set:

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

top
SslAllowedCiphers
procedure CkUpload_getSslAllowedCiphers(objHandle: HCkUpload; outPropVal: HCkString); stdcall;
procedure CkUpload_putSslAllowedCiphers(objHandle: HCkUpload; newPropVal: PWideChar); stdcall;
function CkUpload__sslAllowedCiphers(objHandle: HCkUpload): PWideChar; stdcall;
Introduced in version 9.5.0.55

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"

See the notes about PWideChar memory ownership and validity.

top
SslProtocol
procedure CkUpload_getSslProtocol(objHandle: HCkUpload; outPropVal: HCkString); stdcall;
procedure CkUpload_putSslProtocol(objHandle: HCkUpload; newPropVal: PWideChar); stdcall;
function CkUpload__sslProtocol(objHandle: HCkUpload): PWideChar; stdcall;
Introduced in version 9.5.0.55

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".

See the notes about PWideChar memory ownership and validity.

top
TlsPinSet
procedure CkUpload_getTlsPinSet(objHandle: HCkUpload; outPropVal: HCkString); stdcall;
procedure CkUpload_putTlsPinSet(objHandle: HCkUpload; newPropVal: PWideChar); stdcall;
function CkUpload__tlsPinSet(objHandle: HCkUpload): PWideChar; stdcall;
Introduced in version 9.5.0.55

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.

See the notes about PWideChar memory ownership and validity.

More Information and Examples
top
TotalUploadSize
function CkUpload_getTotalUploadSize(objHandle: HCkUpload): LongWord; stdcall;

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.

This property is also set during synchronous uploads.

top
UploadInProgress
function CkUpload_getUploadInProgress(objHandle: HCkUpload): wordbool; stdcall;

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.

top
UploadSuccess
function CkUpload_getUploadSuccess(objHandle: HCkUpload): wordbool; stdcall;

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.

top
VerboseLogging
function CkUpload_getVerboseLogging(objHandle: HCkUpload): wordbool; stdcall;
procedure CkUpload_putVerboseLogging(objHandle: HCkUpload; newPropVal: wordbool); stdcall;

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

top
Version
procedure CkUpload_getVersion(objHandle: HCkUpload; outPropVal: HCkString); stdcall;
function CkUpload__version(objHandle: HCkUpload): PWideChar; stdcall;

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

See the notes about PWideChar memory ownership and validity.

More Information and Examples
top

Methods

AbortUpload
procedure CkUpload_AbortUpload(objHandle: HCkUpload) stdcall;

May be called during an asynchronous upload to abort.

top
AddCustomHeader
procedure CkUpload_AddCustomHeader(objHandle: HCkUpload;
    name: PWideChar;
    value: PWideChar) stdcall;

Adds a custom HTTP header to the HTTP upload.

top
AddFileReference
procedure CkUpload_AddFileReference(objHandle: HCkUpload;
    name: PWideChar;
    filename: PWideChar) stdcall;

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.

top
AddParam
procedure CkUpload_AddParam(objHandle: HCkUpload;
    name: PWideChar;
    value: PWideChar) stdcall;

Adds a custom HTTP request parameter to the upload.

top
BeginUpload
function CkUpload_BeginUpload(objHandle: HCkUpload): wordbool; stdcall;

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.

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.

top
BlockingUpload
function CkUpload_BlockingUpload(objHandle: HCkUpload): wordbool; stdcall;

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.

top
BlockingUploadAsync (1)
function CkUpload_BlockingUploadAsync(objHandle: HCkUpload): HCkTask; stdcall;

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

Note: Async method event callbacks happen in the background thread. Accessing and updating UI elements existing in the main thread may require special considerations.

Returns nil on failure

top
ClearFileReferences
procedure CkUpload_ClearFileReferences(objHandle: HCkUpload) stdcall;

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

top
ClearParams
procedure CkUpload_ClearParams(objHandle: HCkUpload) stdcall;

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

top
LoadTaskCaller
function CkUpload_LoadTaskCaller(objHandle: HCkUpload;
    task: HCkTask): wordbool; stdcall;
Introduced in version 9.5.0.80

Loads the caller of the task's async method.

Returns True for success, False for failure.

top
SleepMs
procedure CkUpload_SleepMs(objHandle: HCkUpload;
    millisec: Integer) stdcall;

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.

top
UploadToMemory
function CkUpload_UploadToMemory(objHandle: HCkUpload;
    outData: HCkByteData): wordbool; stdcall;

Writes the complete HTTP POST to memory. The POST contains the HTTP header, any custom params added by calling AddParam, and each file to be uploaded. This is helpful in debugging. It allows you to see the exact HTTP POST sent to the server if BlockingUpload or BeginUpload is called.

Returns True for success, False for failure.

top

Events

Chilkat supports event callbacks for the Delphi DLL starting in version 9.5.0.82.

AbortCheck
function MyAbortCheck(): Integer; cdecl;
Introduced in version 9.5.0.82

Provides the opportunity for a method call to be aborted. The AbortCheck event is fired periodically based on the value of the HeartbeatMs property. If HeartbeatMs is 0, then no AbortCheck events will fire. As an example, to fire 5 AbortCheck events per second, set the HeartbeatMs property equal to 200. Return True to abort; return False to continue (not abort)

More Information and Examples
top
PercentDone
function MyPercentDone(pctDone: Integer): Integer; cdecl;
Introduced in version 9.5.0.82

Provides the percentage completed for any method that involves network communications or time-consuming processing (assuming it is a method where a percentage completion can be measured). This event is only fired when it is possible to know a percentage completion, and when it makes sense to express the operation as a percentage completed. The pctDone argument will have a value from 1 to 100. For operations (Chilkat method calls) that complete very quickly, the number of PercentDone callbacks will vary, but the final callback should have a value of 100. For long running operations, no more than one callback per percentage point will occur (for example: 1, 2, 3, ... 98, 99, 100).

The PercentDone callback counts as an AbortCheck event. For method calls that complete quickly such that PercentDone events fire, it may be that AbortCheck events don't fire because the opportunity to abort is already provided in the PercentDone callback. For time consuming operations, where the amount of time between PercentDone callbacks are long, AbortCheck callbacks may be used to allow for the operation to be aborted in a more responsive manner.

Return True to abort; return False to continue (not abort)

More Information and Examples
top
ProgressInfo
procedure MyProgressInfo(name: PWideChar; value: PWideChar) cdecl;
Introduced in version 9.5.0.82

A general name/value event that provides information about what is happening during a method call. To find out what information is available, write code to handle this event and log the name/value pairs. Most are self-explanatory.

More Information and Examples
top
TaskCompleted
procedure MyTaskCompleted(task: HCkTask) cdecl;
Introduced in version 9.5.0.82

Called in the background thread when an asynchronous task completes.

top