[SOLVED] FTP Problem Extra Characters

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
kwasson123
Forum Newbie
Posts: 3
Joined: Mon Aug 23, 2004 10:48 am

FTP Problem Extra Characters

Post 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
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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)
kwasson123
Forum Newbie
Posts: 3
Joined: Mon Aug 23, 2004 10:48 am

Post by kwasson123 »

Thanks I will try this
kwasson123
Forum Newbie
Posts: 3
Joined: Mon Aug 23, 2004 10:48 am

Post 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.
Post Reply