in reply to Net::FTP get problem

joedarock:

If you can create directories on the server but have trouble getting a file, I'd suspect either:

Other than those, I can't think of anything in particular. It would be helpful to see some diagnostics.

...roboticus

When your only tool is a hammer, all problems look like your thumb.

Replies are listed 'Best First'.
Re^2: Net::FTP get problem
by joedarock (Initiate) on Jul 31, 2017 at 11:57 UTC
    roboticus Permissions on both ends look OK. The "join" line prints a directory listing w/permissions. I'm new to Perl...can you provide guidance on how to get some diagnostics that might be useful to you?

      joedarock:

      Have you tried manually doing the FTP through an FTP client? It might be helpful to verify that you can fetch the file manually to help narrow down where the problem could be.

      As far as collecting more diagnostic information, you're already telling the FTP object to report debug information. Perhaps you can increase the debug level to get more details.

      Have you tried using the Passive option? Some servers/firewalls (I don't recall which) won't perform file transfers except via Passive mode.

      ...roboticus

      When your only tool is a hammer, all problems look like your thumb.

      What are the permissions on the directory that contains your script. Try this script in the same directory as your script to check the directory is writable to by your webserver

      #!/usr/bin/perl # testwrite.pl use strict; use Cwd; print "Content-type: text/plain\n\n"; my $cwd = cwd(); if ( open my $fh,'>',$cwd.'/testwrite' ){ print "OK $cwd is writable" } else { print "ERROR $cwd is NOT writable" }
      poj
        roboticus Yes, I can download from the directory with an FTP client and yes, your script executed and reported that the file is writable. I ran your script from the command line as well as from the web browser. I also ran my script from the command line instead of from the browser and still get the error message that it can't open the file.