This example demonstrates how to add progress monitoring for FTP uploads and downloads using Chilkat FTP-2.
<font face=\"courier\" size=2>
public void OnPercentDone(object source, Chilkat.PercentDoneEventArgs args)
{
progressBar1.Value = args.PercentDone;
}
// FTP Get
private void button6_Click(object sender, System.EventArgs e)
{
Chilkat.Ftp2 ftp = new Chilkat.Ftp2();
ftp.UnlockComponent("test");
ftp.Hostname = "ftp.chilkatsoft.com";
ftp.Username = "****";
ftp.Password = "****";
ftp.EnableEvents = true;
ftp.OnPercentDone += new Ftp2.PercentDoneEventHandler(OnPercentDone);
bool b = ftp.Connect();
if (b)
{
ftp.GetFile("ChilkatZipSE.exe","ChilkatZipSE.exe");
MessageBox.Show("Done!");
}
else
{
MessageBox.Show("Failed to connect");
}
}
// FTP Put
private void button5_Click(object sender, System.EventArgs e)
{
Chilkat.Ftp2 ftp = new Chilkat.Ftp2();
ftp.UnlockComponent("test");
ftp.Hostname = "ftp.chilkatsoft.com";
ftp.Username = "****";
ftp.Password = "****";
ftp.EnableEvents = true;
ftp.OnPercentDone += new Ftp2.PercentDoneEventHandler(OnPercentDone);
bool b = ftp.Connect();
if (b)
{
ftp.PutFile("uploadTest.txt","uploadTest.txt");
MessageBox.Show("Done!");
}
else
{
MessageBox.Show("Failed to connect");
}
}
</font>