sub upload_image() { use Net::FTP; my $path = $_[0]; # path received from HTML form input - location of image on local machine my ($username, $password, $directory) = ("xxxx", "xxxx", "/www/path/to/store/files"); my $ftp = Net::FTP->new("www.xxxxxxxx.net", Timeout => 30, Debug => 1) || die &show_error("Unable to connect to ftp: $!"); $ftp->login($username, $password) || die &show_error("Unable to login to ftp: $!"); $ftp->cwd($directory) || die &show_error("Unable to change directory: $!"); $ftp->put($path) || die &show_error("Unable to upload $path: $!"); $ftp->quit(); }