FTP: File corruption during ftp transfer

 

Sometimes an issue can occur with files becoming corrupt when uploading through FTP. When viewing the corrupted file through the browser, the following error will be thrown.

"This image cannot be displayed because it contains errors"

This is caused by uploading files through FTP as ASCII file transfer type. The "ASCII transfer type" will transfer the files as regular text files. The "Binary transfer type" will transfer the data in binary mode which handles the files as binary data instead of text data. Setting your FTP client to Binary will prevent your files from becoming corrupted through ftp transit. Please see the following on how to switch your FTP program to Binary as FTP programs will provide the option to change the transfer type.

On the following example we are using WinSCP using the FTP protocol.

To change go to Tools and select Preferences

Under Preferences, select Transfer. On this window, you will be able to configure the settings.

 

If switching your FTP client settings to binary doesn't work another possible cause of file corruption during FTP transfers could be from your local firewall. Please also check for any updates to your firewall software, and possibly restart your router as well.