Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Perl Misc > Net::FTP error on put: Bad command sequence

Reply
Thread Tools

Net::FTP error on put: Bad command sequence

 
 
mnagaraj@gmail.com
Guest
Posts: n/a
 
      04-18-2006
This is the code producing the error:
<---------------snip----------->
use strict;
use warnings;
use Net::FTP;

my $firm_user = 'string1';
my $firm_pass = "string2";
my $firm_dir = "string3";
my $outfile = "string4";

#Open a socks FTP connection
my $ftp = Net::FTP->new('socks');

$ftp->login($firm_user, $firm_pass)
or die print("ERROR! Unable to connect to the FTP server: ",
$ftp->message);

$ftp->ascii();

$ftp->cwd($firm_dir)
or die print("ERROR! Unable to 'cd' to $firm_dir directory: ",
$ftp->message);

$ftp->put($outfile)
or die print("ERROR! Unable to ftp the file at this time: ",
$ftp->message);

$ftp->quit;
<--------end snip-------->

I tried, ls, pwd, etc and all these work. I tried the FTP from the
shell and it works just fine. Any clues as to what might cause this
error.

BTW this program did work in the past. I am clueless as to the source
of the error!

Thanks,

-mouli.

 
Reply With Quote
 
 
 
 
J. Gleixner
Guest
Posts: n/a
 
      04-18-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:
> This is the code producing the error:
> <---------------snip----------->
> use strict;
> use warnings;
> use Net::FTP;
>
> my $firm_user = 'string1';
> my $firm_pass = "string2";
> my $firm_dir = "string3";
> my $outfile = "string4";
>
> #Open a socks FTP connection
> my $ftp = Net::FTP->new('socks');
>
> $ftp->login($firm_user, $firm_pass)
> or die print("ERROR! Unable to connect to the FTP server: ",
> $ftp->message);
>
> $ftp->ascii();
>
> $ftp->cwd($firm_dir)
> or die print("ERROR! Unable to 'cd' to $firm_dir directory: ",
> $ftp->message);
>
> $ftp->put($outfile)
> or die print("ERROR! Unable to ftp the file at this time: ",
> $ftp->message);
>
> $ftp->quit;
> <--------end snip-------->
>
> I tried, ls, pwd, etc and all these work. I tried the FTP from the
> shell and it works just fine. Any clues as to what might cause this
> error.
>
> BTW this program did work in the past. I am clueless as to the source
> of the error!


First, the die command works just fine, no need to die print:

$ftp->cwd($firm_dir)
or die "ERROR! Unable to 'cd' to $firm_dir directory: " . $ftp->message;

perldoc -f die

Second, add Debug => 1, to the new to see if that helps.

Third, does $outfile exist?


 
Reply With Quote
 
 
 
 
mnagaraj@gmail.com
Guest
Posts: n/a
 
      04-19-2006
J.Gleixner,

I included 1 & 2 as recommended by you.
On 3, yes $outfile does exist. If it doesn't, I get a different error
(local file not found error).

Here is the result of the debug trace:

Outfile: a
Net::FTP>>> Net::FTP(2.75)
Net::FTP>>> Exporter(5.562)
Net::FTP>>> Net::Cmd(2.26)
Net::FTP>>> IO::Socket::INET(1.25)
Net::FTP>>> IO::Socket(1.26)
Net::FTP>>> IO::Handle(1.21)
Net::FTP=GLOB(0x31d2<<< 220 Secure Gateway FTP server
Net::FTP=GLOB(0x31d2>>> user anonymous@**.com
Net::FTP=GLOB(0x31d2<<< 331-Connected to **.com
Net::FTP=GLOB(0x31d2<<< 331-(vsFTPd 1.2.1)
Net::FTP=GLOB(0x31d2<<< 331 Please specify the password.
Net::FTP=GLOB(0x31d2>>> PASS ....
Net::FTP=GLOB(0x31d2<<< 230 Login successful.
Net::FTP=GLOB(0x31d2>>> TYPE A
Net::FTP=GLOB(0x31d2<<< 200 Switching to ASCII mode.
Net::FTP=GLOB(0x31d2>>> CWD pub/incoming
Net::FTP=GLOB(0x31d2<<< 250 Directory successfully changed.
Net::FTP=GLOB(0x31d2>>> PORT 69,52,99,54,135,100
Net::FTP=GLOB(0x31d2<<< 200 PORT command successful. Consider using
PASV.
Net::FTP=GLOB(0x31d2>>> NLST
Net::FTP=GLOB(0x31d2<<< 150 Here comes the directory listing.
Net::FTP=GLOB(0x31d2<<< 226 Directory send OK.
Net::FTP=GLOB(0x31d2>>> ALLO 6
Net::FTP=GLOB(0x31d2<<< 202 ALLO command ignored.
Net::FTP=GLOB(0x31d2>>> PORT 69,52,99,54,135,101
Net::FTP=GLOB(0x31d2<<< 530 Bad command sequence
ERROR! Unable to ftp the file at this time: Bad command sequence

Noting the recommendation for Passive mode, I tried that with the same
result.

Thanks for your help.

-mouli.

 
Reply With Quote
 
l v
Guest
Posts: n/a
 
      04-20-2006
(E-Mail Removed) wrote:
> J.Gleixner,
>
> I included 1 & 2 as recommended by you.
> On 3, yes $outfile does exist. If it doesn't, I get a different error
> (local file not found error).
>
> Here is the result of the debug trace:
>
> Outfile: a
> Net::FTP>>> Net::FTP(2.75)
> Net::FTP>>> Exporter(5.562)
> Net::FTP>>> Net::Cmd(2.26)
> Net::FTP>>> IO::Socket::INET(1.25)
> Net::FTP>>> IO::Socket(1.26)
> Net::FTP>>> IO::Handle(1.21)
> Net::FTP=GLOB(0x31d2<<< 220 Secure Gateway FTP server
> Net::FTP=GLOB(0x31d2>>> user anonymous@**.com
> Net::FTP=GLOB(0x31d2<<< 331-Connected to **.com
> Net::FTP=GLOB(0x31d2<<< 331-(vsFTPd 1.2.1)
> Net::FTP=GLOB(0x31d2<<< 331 Please specify the password.
> Net::FTP=GLOB(0x31d2>>> PASS ....
> Net::FTP=GLOB(0x31d2<<< 230 Login successful.
> Net::FTP=GLOB(0x31d2>>> TYPE A
> Net::FTP=GLOB(0x31d2<<< 200 Switching to ASCII mode.
> Net::FTP=GLOB(0x31d2>>> CWD pub/incoming
> Net::FTP=GLOB(0x31d2<<< 250 Directory successfully changed.
> Net::FTP=GLOB(0x31d2>>> PORT 69,52,99,54,135,100
> Net::FTP=GLOB(0x31d2<<< 200 PORT command successful. Consider using
> PASV.
> Net::FTP=GLOB(0x31d2>>> NLST
> Net::FTP=GLOB(0x31d2<<< 150 Here comes the directory listing.
> Net::FTP=GLOB(0x31d2<<< 226 Directory send OK.
> Net::FTP=GLOB(0x31d2>>> ALLO 6
> Net::FTP=GLOB(0x31d2<<< 202 ALLO command ignored.
> Net::FTP=GLOB(0x31d2>>> PORT 69,52,99,54,135,101
> Net::FTP=GLOB(0x31d2<<< 530 Bad command sequence
> ERROR! Unable to ftp the file at this time: Bad command sequence
>
> Noting the recommendation for Passive mode, I tried that with the same
> result.
>
> Thanks for your help.
>
> -mouli.
>

I'm betting that the file name in $outfile is causing the problem.
Meaning it contains some characters which the ftp server does not like.

What is the exact contents of $outfile which cause the error?
What is in the ftp logs?

Len

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
integer >= 1 == True and integer.0 == False is bad, bad, bad!!! rantingrick Python 44 07-13-2010 06:33 PM
Bad media, bad files or bad Nero? John Computer Information 23 01-08-2008 09:17 PM
ActiveX apologetic Larry Seltzer... "Sun paid for malicious ActiveX code, and Firefox is bad, bad bad baad. please use ActiveX, it's secure and nice!" (ok, the last part is irony on my part) fernando.cassia@gmail.com Java 0 04-16-2005 10:05 PM
24 Season 3 Bad Bad Bad (Spoiler) nospam@nospam.com DVD Video 12 02-23-2005 03:28 AM
24 Season 3 Bad Bad Bad (Spoiler) nospam@nospam.com DVD Video 0 02-19-2005 01:10 AM



Advertisments