<p>I am using a <B> FTPS </b> connection to send a text file
<i>[this file will contain EDI(Electronic Data Interchange) information]</i>to a mailbox INOVIS.I have configured the system to open a FTPS connection and using the PUT command I write the file to a folder on the FTP server.
The problem is: what mode of file transfer should I use? How do I switch between modes?</p>

<p>Moreover which mode  is the 'best-practice' to use when transferring file over FTPS connection.
If some one can provide me a small ftp script it would be helpful.</p>

[{'answer_id': 81503, 'author': 'stephbu', 'author_id': 12702, 'author_profile': 'https://Stackoverflow.com/users/12702', 'pm_score': -1, 'selected': False, 'text': '<p>If you want an exact copy the data use binary mode - using ascii mode will assume the data is 7bit text (chars 0-127) and truncate any data outside of this range.  Dates back to arcane 7bit networking days where ascii mode could save you time.</p>\n\n<p>In a globalized environment that we live in - such that it is quite common to find non-ascii characters e.g. foreign languages, currency symbols etc. - you should always use BINARY mode.</p>\n'}, {'answer_id': 81515, 'author': 'GodEater', 'author_id': 6756, 'author_profile': 'https://Stackoverflow.com/users/6756', 'pm_score': 0, 'selected': False, 'text': "<p>ASCII mode also makes file sharing of text files across different platforms more straightforward for end users. They won't have to worry about the default line ending (cr/lf versus just lf for example) since the ASCII mode will do that translation for them on the fly.</p>\n\n<p>For most file types you will ALWAYS want to use BINARY mode though.</p>\n"}, {'answer_id': 81523, 'author': 'Victor', 'author_id': 14514, 'author_profile': 'https://Stackoverflow.com/users/14514', 'pm_score': 1, 'selected': False, 'text': '<p>ASCII mode changes new line characters between unix and DOS formats. \\n to \\r\\n and viceversa.</p>\n'}, {'answer_id': 81528, 'author': 'Dark Shikari', 'author_id': 11206, 'author_profile': 'https://Stackoverflow.com/users/11206', 'pm_score': 0, 'selected': False, 'text': "<p>ACSII mode converts text files between UNIX and Windows formats based on the server and client platform (CR/LF vs LF), Binary doesn't.  Of course, if you transfer nearly anything in ASCII mode that isn't text, it will probably be corrupted for that reason.</p>\n"}, {'answer_id': 81530, 'author': 'pilif', 'author_id': 5083, 'author_profile': 'https://Stackoverflow.com/users/5083', 'pm_score': 1, 'selected': False, 'text': "<p>Actually, ASCII/BINARY has nothing to do with the 8th bit. It's a convention for translating line endings.</p>\n\n<p>When you are on a windows machine talking to a Unix FTP server (FTPS or FTP - doesn't matter - the protocol is the same), the server will replace any &lt;CR&gt;&lt;LF&gt;-Combination with &lt;LF&gt; before storing the file and consequently do the translation in reverse in case you get the file from the unix server.</p>\n\n<p>The idea behind ASCII mode is to convert the line endings to the respective endings of the target platform.</p>\n\n<p>As todays world seems to be converging to the unix convention (&lt;LF&gt;) and as nearly all of todays editors (aside of notepad) can easily handle Unix-Line-Endings, the days of ASCII mode are, indeed, numbered and I would by all means recommend to always use BINARY transfer mode.</p>\n\n<p>The prospect of having data altered in mid-transfer is somewhat frightening anyways.</p>\n"}, {'answer_id': 81545, 'author': 'PierreBdR', 'author_id': 7136, 'author_profile': 'https://Stackoverflow.com/users/7136', 'pm_score': -1, 'selected': False, 'text': '<p>For the FTP protocol, the ASCII transfer mode will consider the 8th bit of each of your character as insignificant and will use it for error checking. As for binary transfer mode, your data will be sent as is. Note that sending binary data in ASCII mode will (almost) always end up in data corruption. However, transferring ASCII data in binary mode will work as long as the sending and receiving systems use the 8th bit in the same way (in modern system the 8th bit should stay at 0 to prevent collision with extended ASCII charsets).</p>\n'}, {'answer_id': 235136, 'author': 'Darron', 'author_id': 22704, 'author_profile': 'https://Stackoverflow.com/users/22704', 'pm_score': 2, 'selected': False, 'text': "<p>Many of the other answers to this question are a collection of nearly correct to outright wrong information.</p>\n\n<p>ASCII mode means that the file should be converted to canonical text form on the wire.  Among other things this means:</p>\n\n<ul>\n<li>NVT-ASCII character set.  Even if the original file is in some other character set, such as ASCII, EBCDIC or UTF-8.  Technically this disallows characters with the 8th bit set, but most implementations won't enforce this.</li>\n<li>CRLF line endings.</li>\n</ul>\n\n<p>EBCDIC mode means a similar set of rules, except that the data on the wire should be in EBCDIC.</p>\n\n<p>LOCAL mode allows sending data with a size other than 8 bits per byte.</p>\n\n<p>IMAGE (or BINARY) mode means that the data should be send without any changes.  It is up to the user to ensure that the target system can understand the data once it arrives.</p>\n\n<p>Among other things, this means that the recommendation to use BINARY mode to send text data will fail if one of the systems involved doesn't use a ASCII based character set.</p>\n"}]
['https://Stackoverflow.com/questions/81484', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/15460/']