Good morning Monks. I am having a rather strange problem. I generate a php file (a web page with an embedded logon script) then use Net-FTP to upload it like so:
unless ($suppressftp) { print "FTP starting...\n"; my $ftp = Net::FTP->new("ftp.mysite.com", Debug => 0) or die "Cann +ot connect to ftp.mysite.com: $!"; $ftp->login("uid",'password') or die "Cannot login ", $ftp->messag +e; $ftp->binary; $ftp->cwd("mydir") or die "Cannot change working directory ", $ftp +->message; $ftp->put("$filename\.php") or die "Can't put $filename\.php ", $f +tp->message; $ftp->cwd("gfx") or die "Cannot change working directory ", $ftp-> +message; for my $file ('g_f.png','g_m.png','g_p.png','g_r.png','g_t.png','s +eries_1.png','series_2.png') { print "...writing $file\n"; $ftp->put("gfx/$file") or die "Can't put gfx/$date$file ", $ftp->m +essage; } $ftp->quit; }

Everything uploads fine, but when I try to open the php file with my browser I get a php parse error ("extra $"). If I re-upload the same php file using an FTP client I have (WS-FTP) then the file opens fine.

I've tried uploading the php file in both text and binary mode, same result. Obviously Net-FTP is doing something bad to the php file when it uploads it. Has anyone had this problem or know how to fix?

thanks.....Steve


In reply to Net-FTP corrupting php file by cormanaz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.