HI,
I am trying to upload an image from one server to another. The code I am using looks like this =>
my $ftp_1 = Net::FTP->new("server.one.com", Debug => 1, Passive => 1,
+Timeout => 500) or die "connect failed: $!";
my $ftp2 = Net::FTP->new("server.two.com", Debug => 1, Passive =>
+1);
$ftp1->login("name",'password') or die "login failed: $!";
$ftp2->login("name",'password') or die "login failed: $!";
my $gen_server = "server.one.com";
$ftp1->pwd() or die "pwd failed: $!";
unless (-e $uploaded){die "shit $!";}
$ftp1->binary() or die "type failed: $!";
my $port1 = $ftp2->pasv();
my $server_port1 = $ftp2->port($port1);
my $size1 = $ftp2->size($path);
$ftp2->pasv_xfer($path, $gen_server, $short_name);
$ftp1->stor($short_name);
$ftp1->quit or die "quit failed: $!";
The error message I get from debug is =>
Can't locate object method "port" via package "server.one.com" at /usr/lib/per
l5/site_perl/5.005/Net/FTP.pm line 1057.
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.