Helpful Information
 
 
Category: System Administration
FTP from a CGI script

Does anyone know how to FTP from within a CGI script?

I can't find anything about ftp in any of my Perl books.

I am trying to use Mysql > select > print into file and then ftp it to a mainframe.
Useing command line ftp it works just fine.

Should I try and use `command` or is there a module out there that can do it for me?

there is a Net::FTP module on CPAN...

try looking there.

#!/usr/bin/perl

use Net::FTP;

$ftp = Net::FTP->new("ftp.domain.com", Debug => 0);
$ftp->login('username','password');
$ftp->binary;
#or
$ftp->ascii;
$ftp->cwd("directory");
$ftp->put("/path/to/file.txt");
$ftp->quit;

You'll find most or all ftp commands worth perfectly through this module.

Where can I get this module?

Is it free?
Is there a site that I can download it from?
http://www.devshed.com/Talk/Forums/cool.gif

luciddream already told you but not specific enough. You need to get the libnet package from http://www.perl.com/CPAN-local/modules/by-module/Net/libnet-1.0703.tar.gz










privacy (GDPR)