FTP file upload using perl from local system -


requirement:

i want create script upload files local system ftp server in using perl.

sample code:

use net::ftp;     $ftp = net::ftp->new("some.host.name", debug => 0)       or die "cannot connect some.host.name: $@";     $ftp->login("anonymous",'-anonymous@')       or die "cannot login ", $ftp->message;     $ftp->cwd("/pub")       or die "cannot change working directory ", $ftp->message;     $ftp->get("that.file")       or die "get failed ", $ftp->message;     $ftp->quit; 

p.s: newbie in perl.

you can try code working fine me

use strict; use warnings; use net::ftp;  ($ftp, $host, $user, $pass, $dir, $fpath);  $host = ""; $user = ""; $pass = ""; $dir = "";  $fpath = "";  $ftp = net::ftp->new($host, debug => 0); $ftp->login($user, $pass) || die $ftp->message; $ftp->cwd($dir); $ftp->put($fpath) || die $ftp->message; $ftp->quit;  print $ftp->message; 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -