CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
INDEX
Search Posts SEARCH
POSTS
Who's Online WHO'S
ONLINE
Log in LOG
IN

Home: Perl Programming Help: Intermediate:
FTP

 



David4
Deleted

Mar 9, 2000, 10:38 AM

Post #1 of 3 (725 views)
FTP Can't Post

Has anyone used ftp-upload before? ( http://search.cpan.org/search?dist=ftp-upload ) The installation requires libnet-perl. There was no search result from http://search.cpan.org/ for libnet-perl. Could it already be a part of Perl5? If I get it installed how do I use it as a part of a Perl program?


darian
Deleted

Mar 9, 2000, 12:13 AM

Post #2 of 3 (725 views)
Re: FTP [In reply to] Can't Post

Try here for libnet info and files
http://www.gbarr.demon.co.uk/libnet/


Cure
User

Mar 9, 2000, 2:22 PM

Post #3 of 3 (725 views)
Re: FTP [In reply to] Can't Post

Hi
This script should do what your asking for.
I got it from the Administrator.

use Net::FTP;
# Items in bold are variables you need to set

# Create new FTP object
$ftp = Net::FTP->new($domain);

# Log into $domain";
$ftp->login("$username","$password") | | die "Couldn't log in using usr: $username and pw: $password.\n";

# Change working remote directory
$ftp->cwd("$fullpathtodirectory");
# See where you currently are on the remote server
$dir = $ftp->pwd();

# Switch to ASCII mode
$ftp->ascii;

# Delete a file
$ftp->delete($filetodelete) | | die "Could not delete $filetodelete.\n";
print "Upload successful.<P>";

# Upload a file
$ftp->put("$filetoupload",$newfilename) | | die "Could not upload $filetoupload into $dir.\n";
# Get a file
$ftp->get("$filetoretrieve");

# Make a habit of always including the quit line
$ftp->quit();

Cure

 
 


Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives