ChilkatUpload ActiveX Reference

ChilkatUpload

Chilkat Upload is a freeware component that can be used 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.

Object Creation

(Visual Basic 6.0)
Dim obj As New ChilkatUpload
(ASP)
set obj = Server.CreateObject("Chilkat.Upload")
(VBScript)
set obj = CreateObject("Chilkat.Upload")
(Delphi)
obj := TChilkatUpload.Create(Self);
(FoxPro)
loObject = CreateObject('Chilkat.Upload')
(SQL Server)
EXEC @hr = sp_OACreate 'Chilkat.Upload', @obj OUT
(Javascript)
var obj = new ActiveXObject("Chilkat.Upload");

Properties

ChunkSize As Long

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

DebugLogFilePath As String

Used for debugging in cases where a Chilkat method call hangs and never returns. This should generally never happen. The only causes for this 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.

This property allows one to specifiy a debug file path that will be created (or appended if it already exists) and information will be logged to it as the Chilkat methods are called. If a hang occurs, the log file may be viewed to get information about what happened.

HeartbeatMs As Long

The number of milliseconds between each AbortCheck event callback. The AbortCheck callback allows an application to abort any FTP operation prior to completion. If HeartbeatMs is 0, no AbortCheck event callbacks will occur. Also, AbortCheck callbacks do not occur when doing asynchronous uploads.

Hostname As String

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

IdleTimeoutMs As Long

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

LastErrorHtml As String (read-only)

Error information in HTML format for the last method called.

LastErrorText As String (read-only)

Error information in plain-text format for the last method called.

LastErrorXml As String (read-only)

Error information in XML format for the last method called.

Login As String

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

NumBytesSent As Long (read-only)

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.

Password As String

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

Path As String

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 http://www.chilkatsoft.com/cgi-bin/ConsumeUpload.exe, then
Hostname = "www.chilkatsoft.com" Path = "/cgi-bin/ConsumeUpload.exe"

PercentUploaded As Long (read-only)

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

Port As Long

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

ProxyDomain As String

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

(ASP) HTTP Upload using a Proxy Server Example

(VB6) HTTP Upload using a Proxy Server Example

(Delphi) HTTP Upload using a Proxy Server Example

(FoxPro) HTTP Upload using a Proxy Server Example

(VBScript) HTTP Upload using a Proxy Server Example

ProxyLogin As String

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

ProxyPassword As String

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

ProxyPort As Long

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

ResponseBody As Variant (read-only)

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.

ResponseHeader As String (read-only)

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.

ResponseStatus As Long (read-only)

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

Ssl As Long

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

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

then set:

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

TotalUploadSize As Long (read-only)

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.

UploadInProgress As Long (read-only)

Set to 1 when an asynchronous upload is started. When the asynchronous upload is complete, this property becomes equal to 0. 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.

UploadSuccess As Long (read-only)

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

Version As String (read-only)

The version of the Chilkat Upload component, such as "2.0.0".

Methods

AbortUpload()

May be called during an asynchronous upload to abort.

AddCustomHeader(name As String, value As String)

Adds a custom HTTP header to the HTTP upload.

AddFileReference(name As String, filepath As 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.

AddParam(name As String, value As String)

Adds a custom HTTP request parameter to the upload.

BeginUpload() As Long

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 0. At that point, the UploadSuccess property may be checked to determine success (1) or failure (0).

Returns 1 for success, 0 for failure.

Debugging HTTP Upload

(ASP) Asynchronous HTTPS Upload Example

(VB6) Asynchronous HTTPS Upload Example

(Delphi) Asynchronous HTTPS Upload Example

(FoxPro) Asynchronous HTTPS Upload Example

(PHP using ActiveX) Asynchronous HTTPS Upload Example

(VBScript) Asynchronous HTTPS Upload Example

BlockingUpload() As Long

Uploads files in a synchronous manner. This method does not return until all files have been uploaded, or the upload fails. The files to be uploaded are indicated by calling AddFileReference once for each file (prior to calling this method).

Returns 1 for success, 0 for failure.

Debugging HTTP Upload

IIS 7.0 Upload Size Limitations

IIS 6.0 Upload Size Limitations

(ASP) BlockingUpload Example

(VB6) BlockingUpload Example

(Delphi) BlockingUpload Example

(FoxPro) BlockingUpload Example

(PHP using ActiveX) BlockingUpload Example

(VBScript) BlockingUpload Example

ClearFileReferences()

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

ClearParams()

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

SaveLastError(filename As String) As Long

Saves the last error information to an XML formatted file.

SleepMs(millisec As Long)

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.

UploadToMemory() As Variant

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 a zero-length byte array (as a Variant) on failure.
An empty array will have a UBound of -1 meaning 0 elements.

VariantToString(data As Variant, charset As String) As String

A convenience method to convert bytes encoded in any charset to a string.

Returns a null on failure