Perl发送请求发送文件

时间:2014-09-17 00:46:28

标签: perl

我正在尝试在网站和上传者文件代码中发布文件:

<form action="http://localhost/lab/blog/wp-content/plugins/boxit-2/upload.php" method="POST" enctype="multipart/form-data">
<input type="file" name="qqfile">
<input type="submit" value="Upload">
</form>

我尝试了我的代码:

#!/usr/bin/perl
use warnings;
use LWP::UserAgent;
use HTTP::Request::Common 'POST';

my $ua = LWP::UserAgent->new;
my $url = 'http://localhost//upload.php'; 
    Content_Type => 'multipart/form-data',
    Content => [
        file =>"1.html",
        submit  => 1,
    ];
my $rsp = $ua->request( $req );
print $line, $rsp->as_string;

0 个答案:

没有答案