Question

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

Was it helpful?

Solution

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.

OTHER TIPS

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top