Readers: 2
|< 1 2 3 4 >| | 38 entries, 4 pages |
1
2
3
4
5
open FILE, '<', $file or die "open $file $!";
binmode FILE, 'encoding(cp850)' or die $!;
$ftp->put (\*FILE) or die "$server: cannot put $file: " . $ftp->message;
$ftp->put(local,server);
$ftp->put(\*FILE, $file) or die .........
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/perl -w
use strict;
use warnings;
use Net::FTP;
use Net::Netrc;
my $server = "X.X.X.X";
my $user = "user";
my $password = "password";
my $destination = "/www/ftp";
my $file = "/home/files/testfile.txt";
my $ftp = Net::FTP->new ($server, Timeout => 9000, Debug => 3);
$ftp or die "$server: cannot connect: $@";
$ftp->login ($user,$password) or die "$_: Could not login: " . $ftp->message;
$ftp->cwd($destination);
open FILE, '<', $file or die "open $file $!";
binmode FILE, 'encoding(cp850)' or die $!;
$ftp->put(\*FILE, $file) or die "$server: cannot put $file: " . $ftp->message;
$ftp->quit;
Quoteput ( LOCAL_FILE [, REMOTE_FILE ] )
Put a file on the remote server. LOCAL_FILE may be a name or a filehandle. If LOCAL_FILE is a filehandle then REMOTE_FILE must be specified. If REMOTE_FILE is not specified then the file will be stored in the current directory with the same leafname as LOCAL_FILE.
Returns REMOTE_FILE, or the generated remote filename if REMOTE_FILE is not given.
NOTE: If for some reason the transfer does not complete and an error is returned then the contents that had been transfered will not be remove automatically.
1
2
3
4
5
6
7
8
9
@VÁ4
©ãÔÀÔSvVW>¢&4& &&Æ~µáßüc¯øÇÀÒj×úÛß]ŨÉlÓ¤"T,d
& &\WªÙÙ-ÔLÌÌÄdîÉÉÓR9¥O&êk³ÉS¼z&Tç¹µ7 !&æQë&Aê1ßúT1iÐù -&ÏTz&.Õn-6ÎB¨äôïõ¡&Ía-#2±&Ô&~UÝØUÕcµ5aE*Fá· qùSÏãYòØ%.fdjµÔ&ï&&L&ø+R±:.³¬hÐ
v&Õª&p#&Õyô
¾üÕ£çêkâ&&v
ÃãO&¡,S\Gwõó`&Øÿßeÿ*ó1tïº=üª³I¤÷þ¿S&h¼ÔIdf&í -Íue1j&&)h@rs¸ú&+&
V00A+ëÆ=k£ð9Û¨ÍÏü±R8éÏZùüá/ªMú~hú¼&ÞÆÂþ&&;v!D&[&FiF )ÇQ&EÚá&;ä&éKÉV ÿë×Á3ô
Üuü
Quoteput ( LOCAL_FILE [, REMOTE_FILE ] )
Put a file on the remote server. LOCAL_FILE may be a name or a filehandle. If LOCAL_FILE is a filehandle then REMOTE_FILE must be specified. If REMOTE_FILE is not specified then the file will be stored in the current directory with the same leafname as LOCAL_FILE.
Returns REMOTE_FILE, or the generated remote filename if REMOTE_FILE is not given.
NOTE: If for some reason the transfer does not complete and an error is returned then the contents that had been transfered will not be remove automatically.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/perl
use strict;
use warnings;
use Net::FTP;
use Net::Netrc;
my $server = "X.X.X.X";
my $user = "user";
my $password = "password";
my $destination = "/www/ftp";
my $file = "/home/files/testfile.txt";
my $ftp = Net::FTP->new ($server, Timeout => 9000, Debug => 3); $ftp or die "$server: cannot connect: $@";
$ftp->login ($user,$password) or die "$_: Could not login: " . $ftp->message;
$ftp->cwd($destination);
if (-f "$file") {
$ftp->ascii;
my $remote_name = $ftp->put($file);
$remote_name or die "$server: cannot put $file: " . $ftp->message;
}
$ftp->quit;
|< 1 2 3 4 >| | 38 entries, 4 pages |