Mombu the Programming Forum

Go Back   Mombu the Programming Forum > Programming > Net::FTP doesn't transfer files
User Name
Password
REGISTER NOW! Mark Forums Read




Reply
1 23rd October 19:51
morten
External User
 
Posts: 1
Default Net::FTP doesn't transfer files



I have a simpe script that is supose to upload a local file to a given
ftp server. There are no problems in logging in, and the file appears
on the remote ftp server, but the problem is that it contains no data.
The script runs perfectly on any other server, but not my FreeBSD
server. Here is the script:

#############################################

#!/usr/bin/perl

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

use Net::FTP;

$ftp = Net::FTP->new("ftp.server.com");
$ftp->login("username","password");

#$ftp->binary;
#$ftp->put("/path/to/file.gif","file.gif") or die $ftp->message;

$ftp->quit;

print "DONE\n\n";

#############################################

When I run the script, it just hangs for a while (seems like a
timeout). The file name that was supose to be transfered, appears on
the remote ftp server right away, but as I said, it contains no data.

I've also run the FTP client app. on the FreeBSD server via SSH, works
fine! I've checked that the Net::FTP module is installed, and it is.
The strange thing is that it works, but just half way... I've also
tried to fetch files from the remote ftp server, without any luck...

Any suggestions on what the reason could be, or how I can figure out a
solution?

Thanks!

Regards,
Morten
  Reply With Quote


 


2 23rd October 19:51
pjacklam
External User
 
Posts: 1
Default Net::FTP doesn't transfer files



The first thing I'd do is to add "DEBUG => 1" to the constructor
to see what's going on.

Peter

--
#!/local/bin/perl5 -wp -*- mode: cperl; coding: iso-8859-1; -*-
# matlab comment stripper (strips comments from Matlab m-files)
s/^((??:[])}\w.]'+|[^'%])+|'[^'\n]*(?:''[^'\n]*)*')*).*/$1/x;
  Reply With Quote
3 23rd October 19:53
robert hjertmann christiansen
External User
 
Posts: 1
Default Net::FTP doesn't transfer files


Could it be that you have some firewall rules to block your passive
port. The Net::FTP module uses passive mode per default.
Try setting Passive => 0 in the common options. (see below)


$ftp = Net::FTP->new("ftp.server.com", Passive => 0);

for non passive mode.


--
Robert Hjertmann Christiansen
Technical University of Denmark
  Reply With Quote
4 23rd October 19:57
morten
External User
 
Posts: 1
Default Net::FTP doesn't transfer files


No difference, unfortunately... I've also tried to fetch a list of
files from the FTP server. I tried the Debug option, but no error
message... this is the message log from the FTP server:

junior Microsoft FTP Service (Version 3.0).
User xxxxxxxx logged in.
Type set to I.
CWD command successful.
CWD command successful.
Opening BINARY mode data connection for file list.
DONE

Seems like it times out after some time (about two minutes), when it
comes to transfering file data or file lists and stuff like that...
But the script completes, since the last print "DONE"; on the end of
the script prints DONE on the end of what is printed...

I don't think the server is behind a firewall, since all functions in
the buildt in ftp application in FreeBSD works fine...

Morten
  Reply With Quote
Reply


Thread Tools
Display Modes




666