Automatically detecting the transfer mode

Top  Previous  Next

When uploading files the transfer mode is by default set to binary. Using the Sftp#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 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 Sftp#setAuto method.

 

Example

 

// automatically detect transfer mode

sftp.setAuto(true);

 

// upload all files in current local directory

sftp.mupload("*.*");





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

© 2021 JSCAPE LLC