通过 FTP 客户端上传的文件被损坏

发布于 2024-08-14 11:44:52 字数 368 浏览 6 评论 0原文

我尝试将文件上传到我的服务器

my.php (普通本地文件)

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

通过 FileZilla FTP 客户端(远程服务器文件)上传后,

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

// OR SOMETIMES LIKE THIS
<?php

$box_title= "SEARCH ME"

?>

我怀疑这是与服务器相关的问题,但不确定。谁能用解决方案解释这个问题

谢谢

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

小猫一只 2024-08-21 11:44:52

上面的评论已经建议查看 ASCII/二进制模式。 FTP 的一个奇怪属性是,文件可以被视为 ASCII 文本(在这种情况下,FTP 传输将自动更改行结尾的编码以适合目标计算机使用的编码)或二进制文件(在这种情况下,它们将被传输)没有任何改变)。

您在问题中引用的残害可能并不像看起来那么糟糕;有些编辑器实际上不显示 UNIX 风格的行结束编码(这是 ASCII 模式下的 FTP 可能放入文件中的编码),即使它在那里。

行结尾的不同编码是便携式计算中的一个持续的痛苦来源......在这种情况下,我可以推荐的最好的事情是让您尝试一下它是否按照您现在的方式工作,如果不工作,尝试将 FTP 客户端的传输模式强制为不同的设置。

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.

寄意 2024-08-21 11:44:52

我愿意支付 0.02 美元。

正如 Jan 所说,这绝对是 ASCII 传输问题。

但是,我认为这不是 FileZilla 客户端的适当或预期行为。

我正在通过 SFTP (SSH) 将 Perl 文件从 Debian Linux 客户端传输到 Debian Linux 服务器。

FileZilla 设置为以 ASCII 模式传输扩展名为 .pl 的文件,但这会产生 Ish Kumar 在原始问题中指出的不正确格式。

以 ASCII 模式传输的文本文件从 *nix 到 *nix 的传输效果应该与从 Windows 到 *nix 的传输效果一样好。

我把这件事归咎于 Filezilla。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文