I am using $ftp->put to upload file to ftp server but it is not working...
Here's the script
#!/usr/bin/perl -w
use strict;
use Net::FTP;
my $ftp = Net::FTP->new("ftp.mydomain.com") or die "INFO: Cann't connect: $@\n";
$ftp->login("login","xxxx") or die "INFO: Couldn't login\n";
$ftp->cwd("/dir/myarea") or die "INFO: Couldn't change directory to \"/dir/myarea"\n";
$ftp->put("hehe.txt") or die "WHAAAAAAAAT THE HELL";
Enter your email address for automatic notification of new posts here
(be sure to whitelist 'feedburner.com' if you use spam filtering)
| Views for this page | ||||
|---|---|---|---|---|
| Today | This Week | This Month | This Year | Overall |
| 4 | 30 | 44 | 1,682 | 10,486 |
/Forum/anonymous37.html copyright June 2006 anonymous All Rights Reserved
Have you tried Searching this site?
Unix/Linux/Mac OS X support by phone, email or on-site: Support Rates
This is a Unix/Linux resource website. It contains technical articles about Unix, Linux and general computing related subjects, opinion, news, help files, how-to's, tutorials and more. We appreciate comments and article submissions.
Fri Jun 30 11:25:20 2006: Subject: TonyLawrence
Well, as shown it would fail at
$ftp->cwd("/dir/myarea") or die "INFO: Couldn't change directory to \"/dir/myarea"\n";
because you didn't quote the " after myarea.
But other than that it looks fine.
But you didn't bother to say HOW it fails? Can you "put" a file manually if you just ftp from the command line?
Sun Jul 2 14:54:41 2006: Subject: rakesh
(your comments go here)
It failed on put command.... Yes I can put manually upload the file.
Sun Jul 2 20:18:14 2006: Subject: TonyLawrence
Do you have to do anything unusual? What do you use for a client? Can you do $ftp->dir or $ftp->get etc? Does it require PASV mode?
Mon Jul 3 07:21:51 2006: Subject: rakesh
(your comments go here)
I can do $ftp->cwd; I can change directory. Previously the same script is used to work. I wouldn't blame that anything is wrong in the script. Then our company moves to new office and some settings might have changes. And the script is not working after that.
Some issues with the settings. I got one link in the net.. but couldn't get the meaning though.
http://forums.devshed.com/ftp-help-113/net-ftp-ftp-put-problem-142860.html
Mon Jul 3 10:38:42 2006: Subject: TonyLawrence
Sounds like that guy was confusing himself with a cgi script. He was trying to upload from his home pc to his webserver -
Replace "WHAT THE HELL" with $ftp->message
What does that say?
Tue Jul 4 10:42:17 2006: Subject: Good catch!! rakesh
No, I am not loading anything from my home pc.
we have redhat7.2 machine from where files are uploaded. our workstation has fedora4 installed in it.
The script works with fedora4 machine. But when I ssh to to redhat7.2 machine and run the same script it fails on $ftp->put command.
I changed the "what The hell" message to $ftp->message.
It dumps following message on the screen..........
"Illegal PORT command"
But again the same script works fine with fedora4 machine and the file is uploaded also.
Anyway I am using ncftpput command instead of $ftp->put command.... But I would appreciate if the same script works on redhat7.2 machine as well.
Thanks lawrence for your effort.....
Tue Jul 4 10:52:43 2006: Subject: TonyLawrence
Well, that's simply saying that it can't talk to you. Most likely you have firewall settings stopping it. Check that machines's rules against the Fedora machine.
If you Google "perl ftp illegal port" you'll find a lot of matches..
Lone-Tar Backup and Disaster Recovery
for Linux and Unix
Add your comments