Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: FTP transfer progress

by rhesa (Vicar)
on Jan 30, 2006 at 01:48 UTC ( [id://526345]=note: print w/replies, xml ) Need Help??


in reply to FTP transfer progress

You won't be able to access progress data by using the put() method, since that's a one-shot method. What you need to do is emulate what put() does. You can do that by using the stor() method, and using the write() method on the resulting Net::FTP::dataconn object.

I don't have a complete solution for you, but the following should get you started:

# advertise that we want to store a file. # $filename should probably not contain a path my $conn = $ftp->stor( $filename ); # open the local file if( open my $fh, $filename ) { my $buf; while(my $read_bytes = read($fh, $buf, 1024) > 0) { $conn->write($buf, $read_bytes); # add your progressbar update here } }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://526345]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2024-03-30 08:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found