Chilkat Examples

ChilkatHOMEAndroid™Classic ASPCC++C#Delphi ActiveXDelphi DLLVisual FoxProJavaMFCObjective-CPerlPHP ActiveXPHP ExtensionPowerShellPythonRubySQL ServerUnicode CUnicode C++Visual Basic 6.0VB.NETVBScript

C# Examples

Certificates
Email Object
Encryption
FTP
HTML-to-XML/Text
Gzip
HTTP
IMAP
MHT / HTML Email
POP3
RSA Encryption
MIME
SMTP
Socket/SSL/TLS
SSH Key
SSH
SFTP
Tar Archive
XML
XMP
Zip

More Examples...
Amazon S3
Bounced Email
CSV
Diffie-Hellman
NTLM

 

 

 

 

 

 

 

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-2014 Chilkat Software, Inc. All Rights Reserved.