Hey guys,
So here is my problem. I've written a nifty little script to ftp a bunch of files and directories to an ftp server of my choice. The only problem with it is that after I upload all of the files, the text files lose all of there line breaks and spacing. I have done some research and discovered that this is because the program that the text files were written on, (probably Dreamweaver) use the windows method of writing line breaks and not the unix method.
I have noticed that when I use FileZilla from my laptop this too also happens. Yet if i use Internet Explorer in FTP mode it does remove the line breaks after the upload.
So anyone got an idea about how to approach this? Should I make the programmer who wrote all these php scripts export them out of a dreamweaver in a specific format? Can i turn on some conversion option in php... I'm confused, any help would be appreciated. thank you.
Wh33t
PHP_FTP,windows,unix & line breaks (funtimes!)
Moderator: General Moderators
feyd | Please use
feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
It is already uploading the files in ascii format.Code: Select all
//Upload all the files
foreach($cms_files as $files_to_upload)
{
$local_file = str_replace($current_cms_root , "cms_current/", $files_to_upload);
$remote_file = str_replace($current_cms_root , $current_cms_root_install, $files_to_upload);
if(ftp_put($conn_id_install,$remote_file,$local_file,FTP_ASCII))
{
print 'File Uploaded ['.$remote_file.']<br>';
} else {
print 'Error uploading ['.$remote_file.']<br>';
}
}feyd | Please use
Code: Select all
andCode: Select all
tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]