in reply to Net::FTP get problem

Why do you have this line, is this a web server run script ?

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

Try listing the contents of the directory

#!/usr/bin/perl use strict; use warnings; use Net::FTP; my $host ='192.168.0.110'; my $user = 'user'; my $pw = 'password'; my $path ='/home/admin/temp'; my $ftp = Net::FTP->new($host, Debug => 1) or die "Could not connect to '$host': $@"; $ftp->login($user, $pw) or die sprintf "Could not login: %s", $ftp->message; $ftp->cwd($path) or die sprintf "Could not cwd to %s", $ftp->message; printf "Current dir = %s\n",$ftp->pwd(); print join "\n",$ftp->dir(); print "End";
poj

Replies are listed 'Best First'.
Re: Net::FTP get problem
by joedarock (Initiate) on Jul 28, 2017 at 20:32 UTC
    poj Yes, this script runs on an Apache web server in an embedded Linux system. I've done a directory listing on the source directory and the requested file is there. Permissions are OK.

      What do you get adding this line to your script after the $ftp->cwd($path) ?

      print join "\n",$ftp->dir();

      Try changing the destination path to /tmp

      $ftp->get($file,"/tmp/$file") or die sprintf "Could not get $file from $path ", $ftp->message;

      poj