Automatically detecting the transfer mode

Top  Previous  Next

When uploading 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 uploading multiple files it is often convenient to have the transfer mode automatically detected and set based on the type of file being uploaded.

 

Binary files such as images should be uploaded using the binary transfer mode. ASCII files such as text documents should be uploaded 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;

// upload all files in current local directory

myFtp.MUpload("*.*");

 

 

[Visual Basic]

' automatically detect transfer mode

myFtp.TransferMode = TransferModes.Auto

' upload all files in current local directory

myFtp.MUpload("*.*")