I'm trying to use NET::FTP to transfer files from a cgi script on a webserver to a ftp server for archiving. The end user will upload a PDF via the cgi script, then it will be sent to the ftp server. For beurocratic reasons these machines must be seperate, and I don't have direct control over the webserver.

The problem is that NET::FTP truncates every file I try to send this way. The file makes it intact to the webserver, but it is truncated when it arrives at the ftp server. Using standard unix ftp I have no problems, however I have not found a way to use anything other than NET::FTP in a perl script. ( scp won't work for anonymous xfers, which I need ). Ascii and binary modes have the same effect as both platforms are running *nix variants ( I've also tested it ).

The relevnant code is:
$ftp->login('anonymous','submit@somesrvr.that.exists.edu'); $ftp->put("$prefix"."$f2"); $ftp->quit;

where "$prefix"."$f2" expands to the local file on the webserver, as the cgi script writes the uploaded file to a temp location ( named $prefix$f2 ) then sends that to the ftp server.

Could anyone point me in the right direction? I've been grepping and hitting google/monks/perl.com/lugs.. etc. for a while now with no luck.

Thanks!
Rogan Creswick
Rogan.Creswick@orst.edu

In reply to NET::FTP truncates files by Anonymous Monk

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.