You could do this which eliminates the need for executing separate append operations for each read:
  1. Open an ftp connection to the remote server
  2. Initiate an append operation and open the data connection to the ftp server.
  3. Start your read loop and write what you read to the data connection. Also perform whatver tracking of the data here.
  4. When done reading, close the data connection. (Crossing your fingers before closing the connection would be advisable here.)
Basically you would be customizing the _store_cmd() routine in Net::FTP with your own process. Sub-classing Net::FTP actually might not be a half-bad way to do this.

Update: Adding a call-back to Net::FTP for progress tracking shouldn't be too hard. It already prints out hash marks using this code in _store_cmd():

if ($hashh) { $count += $len; print $hashh "#" x (int($count / $hashb)); $count %= $hashb; }
Just replace that with your own code.

In reply to Re: Track file upload progress by pc88mxer
in thread Track file upload progress by PerlRob

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.