Page 1 of 1

FTP Problem Extra Characters

Posted: Mon Aug 23, 2004 10:48 am
by kwasson123
I have a problem when FTP'ing a file. I am creating a flat text file and saving in on a linux web server. Using PHP I FTP the file and then change the name of the file. I use this command:

ftp_put($ftp,$new_file,$file_name,FTP_ASCII);
ftp_rename($ftp,$new_file,$rename_file);

Every line on my file ends with a carriage return character and new line character (\r\n). When I view this file on the web server everything is fine. After I ftp the file I have some sort of extra space, in the text editor, EditPlus, it looks like a small square at the end of every line. This square causes problems for the program that picks up the file from the ftp site. Has anyone else had this problem? Does anyone have a fix for this problem? Thanks

Posted: Mon Aug 23, 2004 10:50 am
by feyd
try transferring it in binary.. by default, in ASCII mode, \r\n is converted to \n on *nix system (from what I remember)

Posted: Mon Aug 23, 2004 10:59 am
by kwasson123
Thanks I will try this

Posted: Mon Aug 23, 2004 11:57 am
by kwasson123
Thanks feyd....That was any easy fix. It looks good on my end hopefully the file will process correctly for the system that picks it up from the FTP Site. Thakns again for your help.