Your images get uploaded in network ASCII mode rather that binary mode.
Network ASCII mode is useful when transferring text files (plain text, HTML, etc.). If you transfer, e.g., a text file from a client running Windows to a server running Linux, it will automatically convert all Windows line breaks (
13 10) into Unix line breaks (
10) and add a trailing end-of-file character (
Evidently, this causes file corruption when transferring binary files such as images.
To switch to binary mode, execute this command before
From man ftp:
ascii Set the file transfer type to network ASCII.
This is the default type.
binary Set the file transfer type to support binary image transfer.