Net::FTP doesn't transfer files

Ask a Question related to PERL Modules, Design and Development.

  1. #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
    Morten Tangeraas Guest

  2. Similar Questions and Discussions

    1. Transfer Printmaster files to In Design program
      Can Printmaster 11 files be transfered to the In Design program. Printmaster files are in a pmo and an nws format?
    2. how to best transfer files between Mac and PC on a wireless LAN?
      Hi all - I have a Mac laptop running OS9.2 (not OSX) and a PC laptop running Windows 2000. Both are on a wireless LAN in my house (connected to a...
    3. How to transfer data files...
      I need help on file transfers, to and from, web servers to remote user computers. If anyone knows of a good reference I'd appreciate the tip. If...
    4. Files and Settings Transfer Wizard
      Good Evening, I have the instructions from MS Knowledge Base Article (306187)for using the "Files and Settings Transfer Wizard" so I can make a...
    5. How to transfer files from PowerCenter 166 to G4
      I am trying to transfer files from my old PowerCenter 166 to my G4 using an Ethernet cable. I did this a few years ago but have forgotten how to...
  3. #2

    Default Re: Net::FTP doesn't transfer files

    [email]morten@tangeraas.com[/email] (Morten Tangeraas) wrote:
    > 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:
    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;
    Peter J. Acklam Guest

  4. #3

    Default Re: 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)

    Morten Tangeraas wrote:
    > 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");
    shoud be

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

    for non passive mode.
    > $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
    --
    Robert Hjertmann Christiansen
    Technical University of Denmark
    Robert Hjertmann Christiansen Guest

  5. #4

    Default Re: Net::FTP doesn't transfer files

    Robert Hjertmann Christiansen <robert@hjertmann.dk> wrote in message news:<bo88uu$1hu6$1@gnd.k-net.dk>...
    > 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)
    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
    Morten Tangeraas Guest

  6. #5

    Default Re: Net::FTP doesn't transfer files

    On 3 Nov 2003 05:50:04 -0800, Morten Tangeraas <morten@tangeraas.com> wrote:

    (snip)
    > #$ftp->binary;
    > #$ftp->put("/path/to/file.gif","file.gif") or die $ftp->message;
    Um, I think the fact that these two lines are commented out might
    have something to do with it.

    --
    - Jeff
    Jeff Drumm Guest

  7. #6

    Default Re: Net::FTP doesn't transfer files

    [email]jdrumm@FOAD-you-evil-spammer-bastards.com[/email] (Jeff Drumm) wrote in message news:<G_ydnWeRTobcJDaiRVn-sw@suscom-maine.net>...
    > On 3 Nov 2003 05:50:04 -0800, Morten Tangeraas <morten@tangeraas.com> wrote:
    >
    > (snip)
    >
    > > #$ftp->binary;
    > > #$ftp->put("/path/to/file.gif","file.gif") or die $ftp->message;
    >
    > Um, I think the fact that these two lines are commented out might
    > have something to do with it.
    I just figured it out (me dummie)... The Passive had to be set to 1, not 0, like

    Passive => 1

    .... and now it's working!!!!! Thanks for all your help, folks!

    Regards,
    Morten
    Morten Tangeraas Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139