Files are getting corrupted via FTP Client Upload

谁说胖子不能爱 提交于 2020-01-06 19:49:16

问题


I tried uploading files to my server

my.php (normal local file)

<?php
$box_title= "SEARCH ME"
?>

After uploading via FileZilla FTP Client (remote server file)

// SOMETIMES ABOVE FILE BECOMES
<?php$box_title= "SEARCH ME"?>

// OR SOMETIMES LIKE THIS
<?php

$box_title= "SEARCH ME"

?>

I suspect this is a server related issue, but not sure. Can anyone explain this problem with solution

Thanks


回答1:


An above comment already suggested looking at ASCII/binary mode. It's a weird property of FTP that files can be treated as ASCII text (in which case the FTP transmission will automatically change the encoding of line endings to fit the one used by the target machine) or binary (in which case they'll be transferred without any changes).

The mutilation you quoted in your question is probably not half as bad as it looks; some editors actually do not display UNIX-style line ending encoding (which is what FTP in ASCII mode probably put into your files) even though it's there.

The different encodings for line endings are a constant source of grief in portable computing stuff... in this case the best thing I can recommend is for you to try out if it works the way you do it now, and if it doesn't, try forcing your FTP client's transfer mode to a different setting.




回答2:


I would like to at my $0.02 to this.

As Jan suggested, this is definitely an ASCII transfer issue.

However, I think this is not appropriate or expected behavior from the FileZilla cllient.

I am transferring Perl files from a Debian Linux client to a Debian Linux Server over SFTP (SSH).

FileZilla is set to transfer files with a .pl extension in ASCII mode, but this produces the incorrect format that Ish Kumar noted in the original question.

Text files transferred in ASCII mode should transfer just as well from *nix to *nix as they do from Windows to *nix.

I blame Filezilla for this one.



来源:https://stackoverflow.com/questions/1903442/files-are-getting-corrupted-via-ftp-client-upload

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!