Reputation: 1209
I am using apache.commons.net library for ftp download. In this documentation, it states
To ensure correct operation with all servers, always specify the appropriate file type after connecting to the server.
It does provide
FTPClient.setFileType
function to set File Type. But how do I know if the FTP server use ASCII or Binary? Is there a function to get the FTP server File Type? Or we just try different file types and see which one works?
THanks
Upvotes: 1
Views: 1448
Reputation: 111299
The file type refers to the type of the files you are downloading, not the type of the server. If you are downloading text files you can set the file type to ASCII so that the line separators are changed to the local convention. If you are downloading binary files like images or office documents you should set the file type to binary so that the content is not corrupted.
You'll want to use binary almost always.
Upvotes: 2