If you can tolerate a question from an arch-newbie, I've got one. What I'm trying to do ftp a file resident on my web server to a remote site. I'm having trouble specifying the sever-local path/filename. Here's the code in its most basic version:
use Net::FTP; $ftp = Net::FTP->new("ftp.xyz.com", Timeout => 300, Debug => 1) or + die "Cannot contact $host: $!"; $ftp->login("xxxx",'yyyy'); $ftp->cwd("/"); $ftp->put("/directory-a/filename-b"); $ftp->quit;
Here's the output from my error log:
Net::FTP>>> Net::FTP(2.75) Net::FTP>>> Exporter(5.58) Net::FTP>>> Net::Cmd(2.26) Net::FTP>>> IO::Socket::INET(1.31) Net::FTP>>> IO::Socket(1.29) Net::FTP>>> IO::Handle(1.25) Net::FTP=GLOB(0x82f8768)<<< 220---------- Welcome to Pure-FTPd ------- +--- Net::FTP=GLOB(0x82f8768)<<< 220-You are user number 318 of 1000 allowe +d. Net::FTP=GLOB(0x82f8768)<<< 220-Local time is now 10:41. Server port: +21. Net::FTP=GLOB(0x82f8768)<<< 220-This is a private system - No anonymou +s login Net::FTP=GLOB(0x82f8768)<<< 220 You will be disconnected after 60 seco +nds of inactivity. Net::FTP=GLOB(0x82f8768)>>> user xxxx Net::FTP=GLOB(0x82f8768)<<< 331 User xxxx OK. Password required Net::FTP=GLOB(0x82f8768)>>> PASS .... Net::FTP=GLOB(0x82f8768)<<< 230-User xxxx has group access to: 1000 + Net::FTP=GLOB(0x82f8768)<<< 230 OK. Current restricted directory is / Net::FTP=GLOB(0x82f8768)>>> CWD / Net::FTP=GLOB(0x82f8768)<<< 250 OK. Current directory is / Cannot open Local file directory-a/filename-b: No such file or directo +ry at /home/users/web/blah/cgi-bin/script.cgi line 10 Net::FTP=GLOB(0x82f8768)>>> QUIT Net::FTP=GLOB(0x82f8768)<<< 221-Goodbye. You uploaded 0 and downloaded + 0 kbytes. Net::FTP=GLOB(0x82f8768)<<< 221 Logout.
I've tried various ways of specifying the path including the absolute path on my server to the file without success. However, just now I've figured out that using the absolute path gets past the "Cannot open Local file directory-a/filename-b" message but generates a different error: Can't call method "sockport" on an undefined value at /usr/local/lib/perl5/5.8.8/Net/FTP.pm line 837. Does this indicate a problem with the server configuration? Any suggestions are appreciated.

In reply to CGI/FTP Put question by DrWho_100

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.