Automatically detecting the transfer mode

Top  Previous  Next

When downloading files the transfer mode is by default set to binary. Using the Ftp#setAuto method you may set it 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 Ftp#setAuto method.

 

Example

 

// enable auto transfer mode

ftp.setAuto(true);    

 

// download all files ending with .gif extension to current local directory

ftp.mdownload("*.gif");





Home | Company | Products | Solutions | Purchase | Support | Services | Blog

© 2021 JSCAPE LLC