Xceed .NET Libraries Documentation
SendingFile Event
Example 


Xceed.Ftp Assembly > Xceed.Ftp Namespace > FtpClient Class : SendingFile Event
Raised for each file being sent to the FTP server.
Syntax
'Declaration
 
Public Event SendingFile As TransferringFileEventHandler
'Usage
 
Dim instance As FtpClient
Dim handler As TransferringFileEventHandler
 
AddHandler instance.SendingFile, handler
public event TransferringFileEventHandler SendingFile
Event Data

The event handler receives an argument of type TransferringFileEventArgs containing data related to this event. The following TransferringFileEventArgs properties provide information specific to this event.

PropertyDescription
Gets the path and filename of the local file.  
Gets the filename of the remote file.  
Remarks

When using overloads of the SendFile method that take a System.IO.Stream as a parameter, the value of the TransferringFileEventArgs.LocalFilename property will be System.String.Empty.

Example
The following example demonstrates how to use the SendingFile event to display the name of the file(s) being sent to the FTP server. This example assumes that you are in a Windows application and that the form contains a listbox.
Xceed.Ftp.Licenser.LicenseKey = "FTNXX-XXXXX-XXXXX-XXXX" ' Set license key here to deploy 

Dim ftp As New FtpClient()

AddHandler ftp.SendingFile, AddressOf Me.sending_file

ftp.Connect( "localhost" )
ftp.Login()

ftp.SendMultipleFiles( "C:\Demos\*", True, True )

ftp.Disconnect()

Private Sub sending_file( ByVal sender As Object, ByVal e As TransferringFileEventArgs )

  listBox1.Items.Add( "SENDING " + e.LocalFilename.ToUpper() + " TO " + e.RemoteFilename.ToUpper() )
  listBox1.Refresh()
End Sub
Xceed.Ftp.Licenser.LicenseKey = "FTNXX-XXXXX-XXXXX-XXXX" // Set license key here to deploy 

FtpClient ftp = new FtpClient();

ftp.SendingFile += new TransferringFileEventHandler( this.sending_file );

ftp.Connect( "localhost" );
ftp.Login();

ftp.SendMultipleFiles( @"C:\Demos\*", true, true );

ftp.Disconnect();

private void sending_file( object sender, TransferringFileEventArgs e )
{      
  listBox1.Items.Add( "SENDING " + e.LocalFilename.ToUpper() + " TO " + e.RemoteFilename.ToUpper() );
  listBox1.Refresh();      
}
Requirements

Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2

See Also