#!/usr/bin/perl use strict; use warnings; use LWP::UserAgent; use HTTP::Request::Common; my $url = "http://..../ssuploader.cgi"; my $fn = shift @ARGV; my $ua = LWP::UserAgent->new; my $req = POST( $url, 'Content_Type' => 'multipart/form-data', 'Content' => [ mode => 'up', file_name => [$fn] ], ); my $res = $ua->request($req);
% ./upload-file.pl ./a.txt
<form method="post" enctype="multipart/form-data" name="upup"> <input type="file" name="file_name"> <input type="hidden" name="mode" value="up"> <input type="submit" value="アップロード"> </form>