Click here to get back home

Net::FTP help needed

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
Net::FTP help needed Al Moodie 01-15-2007
Posted by Al Moodie on January 15, 2007, 9:58 pm
Please log in for more thread options


Hi,

I've got Net::FTP working uploading a .txt file.

use Net::FTP;
$ftp = Net::FTP->new("ftp.host.com")
or die "Can't connect: $@\n";

$ftp->login($username, $password)
or die "Couldn't authenticate, even with username and password. \n";

$ftp->put($localfile)
or die "Can't send $localfile: $!\n";

$ftp->quit;

How do I get it to upload a binary file, I don't follow the
documentation. Somewhere in the script I believe I have to put:

type => "binary" Where?

Al Modie

Posted by Peter Billam on January 15, 2007, 10:28 pm
Please log in for more thread options


> use Net::FTP;
> $ftp = Net::FTP->new("ftp.host.com")
> or die "Can't connect: $@\n";
> $ftp->login($username, $password)
> or die "Couldn't authenticate, even with username and password. \n";
> $ftp->put($localfile)
> or die "Can't send $localfile: $!\n";
> $ftp->quit;
>
> How do I get it to upload a binary file, I don't follow the
> documentation. Somewhere in the script I believe I have to put:
> type => "binary" Where?
>
According to "perldoc Net::FTP", binary is a method, just like
login, put and quit are. That should mean something like:

$ftp->login($username, $password)
or die "Couldn't authenticate, even with username and password.\n";
$ftp->binary()
or die "Can't switch to binary mode: $!\n";
$ftp->put($localfile)
or die "Can't send $localfile: $!\n";

Hope this helps, Regards, Peter

--
AUS/TAS/DPIW/CIT/Servers hbt/lnd/l8 6233 3061 http://www.pjb.com.au
Pasaré, pasarémos dice el agua y canta la verdad contra la piedra
-- Pablo Neruda

Posted by Al Moodie on January 16, 2007, 5:07 pm
Please log in for more thread options


On 16 Jan 2007 14:28:30 +1100, Peter Billam


>According to "perldoc Net::FTP", binary is a method, just like
>login, put and quit are. That should mean something like:
>
>$ftp->login($username, $password)
> or die "Couldn't authenticate, even with username and password.\n";
>$ftp->binary()
> or die "Can't switch to binary mode: $!\n";
>$ftp->put($localfile)
> or die "Can't send $localfile: $!\n";
>
>Hope this helps, Regards, Peter

It's simple, it works. I guess I do not have a good understanding of
module use. Thank you.
Al Moodie

Similar ThreadsPosted
Help needed with XML::Smart September 23, 2004, 9:41 am
Help needed with MakeMaker August 15, 2005, 2:37 pm
Audio DSP Info needed October 18, 2004, 11:00 pm
Perl programmer needed June 22, 2006, 2:12 am
fork process help needed March 15, 2007, 8:56 pm
Net::Telnet - Problems using "script->waitfor" - HELP Needed November 26, 2005, 1:13 am
Net::SFTP and Net::SSH::Perl hangs or disconnets. Help needed. October 25, 2004, 2:39 am
Stream filtering Module/Language needed September 24, 2007, 5:34 pm
advice needed on using proper perl graphics module(s) November 4, 2004, 1:02 pm
What module is needed to allow scripts to post to HTTPS sites? August 2, 2006, 8:06 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap