Here's how to upload the POSTed file to a FTP server.

Code: Perl
#!/usr/bin/perl
 
  use CGI;
  use CGI::Carp qw/fatalsToBrowser warningsToBrowser/;
  use Net::FTP;
 
  my $q = new CGI;
 
  print "Content-Type: text/html\n\n";
 
  if($q->param("File"))
  {
      #
      my $h = $q->upload("File");
      open UP,">/tmp/$h";
      binmode UP;
      while(<$h>)
      {
          print UP;
      }
      close UP;
 
      $ftp = Net::FTP->new("ftpserver.com", Debug => 0)   or die "Cannot connect to ftpserver.com: $@"; # connect
      $ftp->login("ftpuser",'ftppassword')  or die "Cannot login ", $ftp->message; # login
      $ftp->cwd("/pub") or die "Cannot change working directory ", $ftp->message; # change dir if required
      $ftp->binary(); # change the mode to binary
      $ftp->put("/tmp/$h","$h"); # upload the file
      $ftp->quit(); # close the control connection
 
 
  }
  else
  {
      print<<HTML;
      <form method="post" enctype="multipart/form-data">
          <input type="file" name="File">
 
          <input type="submit">
      </form>
  HTML
 
  }