Chilkat
HOME
Android™
ASP
Visual Basic
VB.NET
C#
iOS (IPhone)
Objective-C
C++
C
MFC
Delphi
FoxPro
Java
Perl
PHP Extension
PHP ActiveX
Python
PowerShell
Ruby
SQL Server
VBScript
FTP Upload File with Progress MonitoringDownload: Chilkat .NET Assemblies This VB.NET example program demonstrates how to do an FTP upload with progress monitoring. ' When using events, the Chilkat.Ftp2 object must be a class member or global variable. Dim WithEvents ftp2 As New Chilkat.Ftp2 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click ftp2.UnlockComponent("Anything for 30-day trial") ftp2.Hostname = "ftp.chilkatsoft.com" ftp2.Username = "******" ftp2.Password = "*****" ' EnableEvents must be set to True for events to fire. ftp2.EnableEvents = True ' Set the SendBufferSize to a smaller value than the default of 512K to get more frequent callbacks: ' This may slightly degrade performance. ftp2.SendBufferSize = 4096 ' Connect to the FTP server and login. Dim success As Boolean success = ftp2.Connect() If (Not success) Then ftp2.SaveLastError("ftpError.txt") Exit Sub End If ' Navigate to the "testing" subdirectory on the ftp server. success = ftp2.ChangeRemoteDir("testing") If (Not success) Then ftp2.SaveLastError("ftpError.txt") Exit Sub End If ' Upload the file. success = ftp2.PutFile("big.gif", "big.gif") If (Not success) Then ftp2.SaveLastError("ftpError.txt") Exit Sub End If ftp2.Disconnect() End Sub ' Update the progress bar control with the percent done. Private Sub ftp2_OnFtpPercentDone(ByVal sender As Object, ByVal args As Chilkat.FtpPercentDoneEventArgs) Handles ftp2.OnFtpPercentDone ProgressBar1.Value = args.PercentDone End Sub |
© 2000-2012 Chilkat Software, Inc. All Rights Reserved.