Retain Whitespace through textarea/js/ftp_fput

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bmetter
    New Member
    • Jan 2011
    • 2

    #1

    Retain Whitespace through textarea/js/ftp_fput

    Hi there, and thanks in advance for any replies.

    I'm trying to have a user put text (with carriage returns and general formatting) in a textarea with the ID of 'data'. A submit button then passes that through javascript-
    Code:
    <input type='button' value="Save" onclick="javascript:loadXMLDoc('div','read.php?k='+document.getElementById('data').value)></input>
    for simplicity, this is 'read.php', assume connection has been made etc, all that you need to know is $contents contains the $_GET['k'] passed though a function.
    Code:
    fwrite($tmp, $contents);
    rewind($tmp);
    ftp_fput($this->con, $remote_file, $tmp, FTP_ASCII,0);
    Somewhere along the line, I lose the newlines and formatting. Any help? I'll include full code if required, but I think that should be enough....if you need any at all.
  • bmetter
    New Member
    • Jan 2011
    • 2

    #2
    ANSWER:
    urlencode the data before passing it ;)

    Comment

    Working...