• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Issue Files getting corrupted after FTP transfer

Joey van Venrooij

New Pleskian
Hello,

When I upload a PHP file to my server via FTP all is fine and the website is working. But when I download it again the file is corrupted and there are characters like "styÐ% Ð% à¥" °£" 8% ð% @ ð% "

This only happens when I download the file with FTP and not with the file manager. If I upload the PHP file again the website won't work anymore because the server also can't interpreted the characters.

When I issue the command "file filename.php" it says:

file filename.php
filename.php: data

It works when I force the mode to be binary on the client side and when i forced binary mode it actually says the filetype correctly:

file filename.php
filename.php: HTML document, UTF-8 Unicode text
 
Last edited:
This is caused by the transfer type alone. When you upload in Binary mode and download in ASCII mode or upload in ASCII mode and download in Binary mode, line breaks are removed or added that you do not want to happen. A .php-file should be uploaded and downloaded in ASCII mode only, because it is a text file. Normally, in FTP clients you can set a list o file extensions that determines the transfer mode for different file types.
 
You would think that is true but when I upload and download them in ascii mode the files get corrupted. It only stays functional in binary mode. I think the proftpd doesn't support utf-8 unicode. But I couldn't find a fix for this.

This is caused by the transfer type alone. When you upload in Binary mode and download in ASCII mode or upload in ASCII mode and download in Binary mode, line breaks are removed or added that you do not want to happen. A .php-file should be uploaded and downloaded in ASCII mode only, because it is a text file. Normally, in FTP clients you can set a list o file extensions that determines the transfer mode for different file types.
 
Back
Top