linneighborhood has asked for the wisdom of the Perl Monks concerning the following question:

Hi Monks,

I have a scenario where I have to upload and download files from FTP server via proxy.

I can download with the code below:
#################### Download my $ua = new LWP::UserAgent(agent => 'MyAgent/1.0') or die "Error: Can +not create object"; $ua->proxy([qw(http https ftp)] => 'http://proxyhost:8080') or die "Er +ror: Problem with Proxy"; my $response = $ua->get('ftp://ftpuser:password@ftp.host.name/remotefi +le.zip', ':content_file' => localfile.zip) or warn "Warn: Failed to d +ownload file from FTP Server "; if ($response->is_success) { print "Found file on remote server \n"; } else { print "File missing on remote server \n"; } #####################
Above code works perfectly fine for downloading the files.
But I dont know how to upload file on FTP server as POST method throwing error that FTP not supported.
Any help is very much appreciated, Thanks.

Replies are listed 'Best First'.
Re: How to upload file to FTP server via proxy with LWP::UserAgent
by moritz (Cardinal) on Nov 04, 2009 at 13:49 UTC
    FTP as a protocol doesn't have POST (afaict), only put. So either you find something in the documentation that tells you how to do a put operation with LWP, or you have to use a real FTP client for FTP uploads.
    Perl 6 - links to (nearly) everything that is Perl 6.
      I tried to search for PUT method but failed to get anything.
      I also tried to use Net::FTP module but seems it does not support FTP over HTTP.
      Any help appreciated.
        es not support FTP over HTTP.

        Even the services that offer FTP over HTTP, talk FTP to the FTP server, because that is what FTP server expects.