When you manually upload or download files which are other than text files to a Web-Server or When you manually download a file from a web-server using FTP commands or FTP clients like Filezilla or similar clients, the files may or may not work correctly.
Files uploaded or downloaded using FTP get bad mainly because the files become corrupt or damaged because of wrong transfer mode. Most of the client like Filezilla work excellent in selecting the transfer mode for files upload and download, but sometimes this may not work correctly because of encryption on certain files.
I faced this problem when I uploaded an encrypted .php file on my server. This was so because .php files are usually not encrypted, but because I purchased a proprietary script which was encrypted by the author. The Filezilla client considers .php files for ASCII mode FTP transfer. That created problems for me as files were not readable after I uploaded them to the server.
There can be another case when you are downloading a file from the server using command prompt or FTP client like Filezilla and the file does not open or gets corrupt while downloading.
In this article I will share with you the correct settings you should use with Filezilla / while using command prompt to upload / download a file from web-server.
I will share methods for command line transfer and transfer using Filezilla.
Correct Settings To Download / Upload Files in Strictly FTP Mode
Using Filezilla Client
Open Filezilla FTP client, go to the Transfer > Transfer type > Binary
Changing this mode to binary ensured that the binary files do not get corrupt while upload or download. You can permanently set this mode to Binary because Binary Transfer Mode supports both binary as well as ASCII files.
Using Command Prompt for FTP
On command prompt, after you log into the FTP using the username and password, at FTP prompt, type command “bi” to change to binary mode. This will ensure that the files you upload and download are properly in binary mode only.
Hope you find this tutorial will save you from troubles related to file corruption via FTP transfer of binary files in ASCII mode.