VB.NET Examples

ChilkatHOMEAndroid™ASPVisual BasicVB.NETC#iOS (IPhone)Objective-CC++CMFCDelphiFoxProJavaPerl
PHP ExtensionPHP ActiveXPythonPowerShellRubySQL ServerVBScript

VB.NET Examples

Bounced Mail
Bz2
Character Encoding
CSV
Digital Certificates
Digital Signatures
Email
FTP
HTML Conversion
HTTP
IMAP
Encryption
MHT / HTML Email
POP3
PFX
RSA
S/MIME
SMTP
Socket
Spider
SSH
SSH Tunnel
SSH Key
SFTP
Tar Archive
Upload
XML
XMP
Zip Compression
Misc

More Examples...
Amazon S3
Email Object
DKIM / DomainKey
NTLM
FileAccess
RSS
Atom
Self-Extractor
Service
PPMD
Deflate
DH Key Exchange
DSA
Bzip2
LZW

Byte Array
VB.NET FTPS
System.IO

 

 

 

 

 

 

HTTP Asynchronous Upload

Download Chilkat .NET for 4.0 Framework

Download Chilkat .NET for 64-bit 4.0 Framework (x64)

Download Chilkat .NET for 2.0 / 3.5 Framework

Download Chilkat .NET for 64-bit 2.0 / 3.5 Framework (x64)

Download Chilkat .NET for 1.0 / 1.1 Framework

The Chilkat Upload component is freeware. This example demonstrates how to HTTP upload one or more files asynchronously in a background thread and monitor the progress (and potentially abort the upload prior to it finishing). Formal support for the Chilkat Upload component is included with a "Chilkat Bundle" purchase.

'  
' This example demonstrates how to HTTP upload one or more files
    ' asynchronously in a background thread.
    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

        Dim uploadAsync As New Chilkat.Upload()

        ' To upload more than one file, call AddFileReference multiple times --
        ' once for each file to be uploaded.
        ' The formElementName is arbitrary, and can be anything.  
        Dim formElementName As String = "file1"

        ' The localFilename is a file that exists on your local filesystem.
        Dim localFilename As String = "hamlet.xml"

        uploadAsync.AddFileReference(formElementName, localFilename)

        ' The Hostname and Path properties specify the server-side
        ' page/program/script/CGI that will recieve and process the upload.
        uploadAsync.Hostname = "www.freeaspupload.net"
        uploadAsync.Path = "/freeaspupload/testUpload.asp"

        ' Start the upload in a background thread.
        Dim success As Boolean = uploadAsync.BeginUpload()
        If success = False Then
            TextBox1.Text = uploadAsync.LastErrorText
            Return
        End If

        ' Note: When doing asynchronous uploads, there are no event callbacks.
        ' Event callbacks only occur when doing synchronous uploads via the 
        ' BlockingUpload method.

        ' Wait for the upload to finish.
        ' Update the progress as we wait.
        While uploadAsync.UploadInProgress
            ' We can abort the upload at any point by calling:
            ' upload.AbortUpload();
            ' Display the percentage complete and the number of bytes uploaded so far..
            Label1.Text = Convert.ToString(uploadAsync.PercentUploaded) + "% complete"
            Label2.Text = Convert.ToString(uploadAsync.NumBytesSent) + " bytes uploaded..."

            ' Show the percentage completion in a progress bar.
            ProgressBar1.Value = CInt(uploadAsync.PercentUploaded)

            ' The total upload size will become set after the upload begins:
            Label3.Text = "Total Upload Size (in bytes) = " + Convert.ToString(uploadAsync.TotalUploadSize)

            ' Sleep 1/10th of a second.
            uploadAsync.SleepMs(100)

            ' Handle UI events.
            System.Windows.Forms.Application.DoEvents()
        End While

        ' Did the upload succeed?
        If uploadAsync.UploadSuccess Then
            MessageBox.Show("Success!")
        Else
            MessageBox.Show(uploadAsync.LastErrorText)
        End If
    End Sub

 

© 2000-2012 Chilkat Software, Inc. All Rights Reserved.

Mail Component · XML Parser