Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#C# UWP/WinRTDataFlexDelphi ActiveXDelphi DLLVisual FoxProJavaLianjaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerBuilderPowerShellPureBasicPythonRubySQL ServerSwiftTclUnicode CUnicode C++Visual Basic 6.0VB.NETVB.NET UWP/WinRTVBScriptXojo PluginNode.js

C# Examples

Async
Certificates
ECC
Email Object
Encryption
FTP
HTML-to-XML/Text
Gzip
HTTP
IMAP
JSON
MHT / HTML Email
PEM
PFX/P12
Java KeyStore (JKS)
POP3
RSA Encryption
MIME
REST
SCP
SMTP
Socket/SSL/TLS
SSH Key
SSH
SFTP
Stream
Tar Archive
XML
XMP
Zip

More Examples...
Google APIs
Google Cloud Storage
Azure Cloud Storage
Amazon S3 (new)
Google Drive
ASN.1
PRNG
Amazon S3
Bounced Email
CSV
Diffie-Hellman
DKIM / DomainKey
DSA
NTLM
QuickBooks

 

 

 

 

 

 

 

FTP Upload with Progress Monitoring

Download: Chilkat .NET Assemblies

Demonstrates how to upload a file to an FTP server with progress monitoring event callbacks. Also demonstrates how to abort an FTP upload while in progress.

	    // Progress monitor callback -- called each time the percentage completion
	    // updates to a larger value.
	    public void OnPercentDone(object source, Chilkat.PercentDoneEventArgs args)
	    {
		// args.PercentDone is an integer value between 1 and 100.
		progressBar1.Value = args.PercentDone;
		
		// args.Abort can be set to True to abort the FTP while in progress.
		// This example aborts the FTP transfer after it is 50% complete.
		if (args.PercentDone >= 50)
		{
		    args.Abort = true;
		}
	    }

	    // FTP Put with progress monitoring event callbacks.
	    // Upload a file to an FTP server with percent done callbacks.
	    private void button5_Click(object sender, System.EventArgs e)
	    {
		Chilkat.Ftp2 ftp = new Chilkat.Ftp2();
		ftp.UnlockComponent("Any string unlocks for 30-day trial.");
		
		ftp.Hostname = "ftp.chilkatsoft.com";
		ftp.Username = "***";
		ftp.Password = "***";
		
		ftp.EnableEvents = true;

		// Set the SendBufferSize to a smaller value than the default of 512K to get more frequent callbacks:
		// This may slightly degrade performance.
		ftp.SendBufferSize = 4096;
		
		ftp.OnPercentDone += new Ftp2.PercentDoneEventHandler(OnPercentDone);

		bool success = ftp.Connect();
		if (success)
		{
		    success = ftp.PutFile("uploadTest.txt","uploadTest.txt");
		    if (success)
		    {
			MessageBox.Show("Done!");
		    }
		    else
		    {
			MessageBox.Show(ftp.LastErrorText);
		    }
		}
		else
		{
		    MessageBox.Show(ftp.LastErrorText);
		}
	    }

 

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