APLawrence.com -  Resources for Unix and Linux Systems, Bloggers and the self-employed

Net:FTP $ftp->put problem!

Got questions? Go ahead: Ask me anything!



Author: anonymous
Date: Fri Jun 30 09:43:27 2006
Subject: Net:FTP $ftp->put problem!

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","xyzx") 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";



Got something to add? Send me email.





(OLDER)    <- More Stuff -> (NEWER)    (NEWEST)   

Printer Friendly Version

-> -> Net:FTP $ftp->put problem!

7 comments



Increase ad revenue 50-250% with Ezoic


More Articles by © anonymous







Fri Jun 30 11:25:20 2006: 2196   TonyLawrence

gravatar
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: 2206   rakesh




It failed on put command.... Yes I can put manually upload the file.






Sun Jul 2 20:18:14 2006: 2207   TonyLawrence

gravatar
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: 2208   rakesh




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.

(link)






Mon Jul 3 10:38:42 2006: 2209   TonyLawrence

gravatar
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: 2210   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: 2211   TonyLawrence

gravatar
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..

------------------------
Kerio Samepage


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.

Contact us





There are only two things wrong with C++: The initial concept and the implementation. (Bertrand Meyer)





This post tagged: