Re: Net::FTP crashes on ftp->get()
- From: "harryfmudd [AT] comcast [DOT] net" <"harryfmudd [AT] comcast [DOT] net">
- Date: Thu, 16 Feb 2006 19:54:08 -0500
Sisyphus wrote:
"rna8arnold" <rna8arnold@xxxxxxx> wrote in message
news:1140129582.622597.277610@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I am having trouble getting my cgi script using Net::FTP to get a zip
file from a remote server (Microsoft server) into the server where the
script resides (UNIX freeBSD/Apache server). The browser ends up with a
blank page, because the cgi script seems to crash whenever we get to
ftp->get().
I used Komodo to test this script and it worked fine from my WindowsXP
PC. But when the script is uploaded to the website server (UNIX
freeBSD/Apache server) it fails to work properly.
Any ideas what the problem could be?
code:
# setup ftp object
$ftp = Net::FTP->new($host, Timeout=>240, Debug => 1) or
dienice ("Can't ftp to $host: $!\n");
# Login to the ftp site as anonymous
$ftp->login("anonymous") or $newerr = 1;
if ($newerr) {
$ftp->quit;
&dienice ("Can't login to $host: $! $?\n");
}
# go to the directory containing the file
$ftp->cwd($directory) or $newerr=1;
if ($newerr) {
$ftp->quit;
&dienice ("Can't change to $directory: $!\n");
}
$ftp->binary(); # since we are transferring a zip file use binary
instead of ascii
#Get zip archive and place it on local server
$ftp->get($filename, $filename) or $newerr=1;
if ($newerr) {
$success = $false; # failed file probably doesn't exist
}
else {
$success = $true; # file was successfully transferred
}
$transferred_file = $filename; #save pathname of transferred file
#disconnect from the ftp site
$ftp->quit;
Could it be that the local (Unix) machine is unable to copy $filename to the
location specified by $filename ? Perhaps a permissions issue .... or
perhaps the Unix machine just can't cope when $filename is something like
'C:\path\file.ext'.
Cheers,
Rob
What error is FTP returning? It does not come back in $!, as your script seems to assume.
Tom Wyant
.
- References:
- Net::FTP crashes on ftp->get()
- From: rna8arnold
- Re: Net::FTP crashes on ftp->get()
- From: Sisyphus
- Net::FTP crashes on ftp->get()
- Prev by Date: Re: Net::FTP crashes on ftp->get()
- Next by Date: Re: XML::Simple Problem
- Previous by thread: Re: Net::FTP crashes on ftp->get()
- Index(es):
Relevant Pages
|
|