Automatically detecting the transfer mode

Top  Previous  Next

When download files the transfer mode is by default set to binary. Using the TransferModes enumeration you can set the TransferMode property to automatically detect the transfer mode to use (ASCII or binary) based on the file extension of the file transferred. If you are downloading multiple files it is often convenient to have the transfer mode automatically detected and set based on the type of file being downloaded.

 

Binary files such as images should be downloaded using the binary transfer mode. ASCII files such as text documents should be downloaded using the ASCII transfer mode. You can have this handled automatically using the TransferMode property.

 

Example

 

[C#]

// automatically detect transfer mode

myFtp.TransferMode = TransferModes.Auto;

// download all files in current local directory

myFtp.MDownload("*.*");

 

 

[Visual Basic]

' automatically detect transfer mode

myFtp.TransferMode = TransferModes.Auto

' download all files in current local directory

myFtp.MDownload("*.*")