Hello again ...
I have tested it with a testscript. It does not work. The error message is:
Cannot open Local file FH: No such file or directory at test-ftpscalar.pl line 54 put failed (Passive=1) Type set to I ; localfilename(FH): [d:/Dokumente2/Server2/cgi-bin/out//test-ftpscala +r.xml], remotefilename: [test-ftpscalar.xml] at test-ftpscalar.pl lin +e 54.
The script is as follows:
#!/usr/bin/perl print "Content-type: text/html"; print "<html>\n<head>\n<title>Test FTP Sclar</title>\n</head>\n<body>\ +n<p>___ hier gehts los ___:</p>\n<p>\n"; use Net::FTP; my $content = <<__CONTENT__; <inno> <antrag> <tester>THOFMANN(TH)</tester> </antrag> <hinweis> <ziel>Test-Server</ziel> </hinweis> </inno> __CONTENT__ my $server = 'www.lly5.de'; my ($login, $passwd) = ('theoneandonly', 'g1v3m3s0m35h17'); my $localdir = "d:/Dokumente2/Server2/cgi-bin/out/"; my $datei = "test-ftpscalar.pl"; $datei = "test-ftpscalar.xml"; my $remotefile = ''; my $remotefilename; my $passive; my $remotedir = 'public_html/inno/'; my $localfilename; $localfilename = "$localdir\/$datei"; if ($remotefile ne '') { $remotefilename = $remotefile; } else { $remotefilename = $datei; } if ($server =~ m/(www.lly5.de)/i) { # fies, name wurde i +n IP geaendert $passive = 1; $ftp = Net::FTP->new($server, Passive => 1) or die "Cannot connect to $server (Passive=$passiv +e): $@"; } else { $ftp = Net::FTP->new($server) or die "Cannot connect to $server: $@"; } open( FH, "<", \$content) or die "Kann File Handle nic +ht zum lesen aus content oeffnen"; $ftp->login($login, $passwd) or die "Cannot login (Passive=$passive) ", $ftp->m +essage; $ftp->cwd($remotedir) or die "Cannot change working directory (Passive=$ +passive) ", $ftp->message; $ftp->binary or die "Cannot change to binary mode (Passive=$pas +sive) ", $ftp->message; $ftp->put(FH, $remotefilename) or die "put failed (Passive=$passive) ", $ftp->mes +sage, "; localfilename(FH): [$localfilename], remotefilename: [$remot +efilename]"; $ftp->quit; close( FH ); print "*** Fertig FTP ***\n";
Thanks in advance, Thomas
In reply to Re^3: Using Perl FTP to write a string variable as a file
by toohoo
in thread Using Perl FTP to write a string variable as a file
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |