/ Published in: Perl
Simple way to do ftp from Perl
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
use Carp; use Net::FTP; my $ip = ...; # Target machine my $local= ...; # local filename croak "$local file is missing !!\n" unless -f $local; my $remote= ...; # Remote filename my $ftp= Net::FTP->new( $ip ,Port => 21 # Standard port number ,Timeout => 15 # Timeout in seconds ) or croak "Failed to connect to $ip."; my $user= ...; # login user my $pw = ...; # login password $ftp->login( $user, $pw ) or croak "Failed to login."; $ftp->put( $local, $remote) or croak "Failed to ftp."; $ftp->quit();