Gossamer Forum
Home : General : Perl Programming :

Any ideas?

Quote Reply
Any ideas?
Hi. Does anyone know when using this code it doesn't upload the acepassword.cgi file to the server it is set to?

#!/usr/bin/perl
require "settings.cfg";
use Net::FTP;

$ftp =Net::FTP->new("$ftpaddress");
$ftp->login("$username","$password");
$ftp->cwd("$ftpfolder/");
$ftp->site("CHMOD 755 add.cgi");
$ftp->site("CHMOD 755 jump.cgi");
$ftp->site("CHMOD 755 modify.cgi");
$ftp->site("CHMOD 755 rate.cgi");
$ftp->site("CHMOD 755 search.cgi");
$ftp->site("CHMOD 777 admin");
$ftp->site("CHMOD 755 subscribe.cgi");
$ftp->cwd("/admin/");
$ftp->put("acepasssword.cgi");
$ftp->site("CHMOD 755 acepassword.cgi");
$ftp->quit;

It seems to CHMOD files and folders fine, but when it comes to uploading it just doesn't want to know. Any ideas anyone???

Thanks

Andy

webmaster@ace-installer.com
http://www.ace-installer.com
Quote Reply
Re: Any ideas? In reply to
Try using error checking as I've mentioned to you several times....

$ftp->login("$username","$password") || die &error("Couldn't login : $!");
$ftp->cwd("$ftpfolder/") || die &error("Couldn't cd to $ftpfolder : $!");
$ftp->site("CHMOD 755 add.cgi") || die &error("Couldn't chmod add.cgi : $!");
$ftp->site("CHMOD 755 jump.cgi") || die &error("Couldn't chmod jump.cgi : $!");
$ftp->site("CHMOD 755 modify.cgi") || die &error("Couldn't chmod modify.cgi : $!");
$ftp->site("CHMOD 755 rate.cgi") || die &error("Couldn't chmod rate.cgi : $!");
$ftp->site("CHMOD 755 search.cgi") || die &error("Couldn't chmod search.cgi : $!");
$ftp->site("CHMOD 777 admin") || die &error("Couldn't chmod admin.cgi : $!");
$ftp->site("CHMOD 755 subscribe.cgi") || die &error("Couldn't chmod subscribe.cgi : $!");
$ftp->cwd("/admin/") || die &error("Couldn't cd to /admin/ : $!");
$ftp->put("acepasssword.cgi") || die &error("Couldn't put acepassword.cgi : $!");
$ftp->site("CHMOD 755 acepassword.cgi") || die &error("Couldn't chmod acepassword.cgi : $!");


sub error {

my ($msg) = shift;

print "Content-type: text/html\n\n";

print $msg;

exit();

}



Looks like you also need to learn about paths. You are trying to cd to /admin/ which will try to find an admin directory in the root which doesn't exist. You would need to use admin/

A Links2 installer should know how to use basic paths IMHO Wink


Installations:http://www.wiredon.net/gt/
Favicon:http://www.wiredon.net/favicon/

Quote Reply
Re: Any ideas? In reply to
Yup, just worked that out....lol Wink

I'm not used to using Net::FTP. Its all working now. Just needed to use;

$ftp->cwd("$ftpfolder/admin");

instead of

$ftp->cwd("/admin");

Thanks though Cool

Andy

webmaster@ace-installer.com
http://www.ace-installer.com
Quote Reply
Re: Any ideas? In reply to
http://www.cgi101.com/modules/Net.FTP.html

Check your code more thoroughly also before posting next time.

Installations:http://www.wiredon.net/gt/
Favicon:http://www.wiredon.net/favicon/