我正在尝试使用多部分实体的API。我猜有些东西我不知道了。
我目前的代码如下:
#!/usr/bin/perl
#$request = $ua->request($request);
#my $results=$ua->request($request);
$content = $request->content;
#print "Content-type: application/xml\n\n";
print $content;
exit;
答案 0 :(得分:1)
您必须将要创建的内容类型添加到POST的参数中,并将文件名作为数组引用提供。这应该有效:
my $request=(POST 'http://servername/test.jsp',
Content_Type => 'form-data',
Content => [
appGUID => "Test",
userId => "User",
password => "<Password>",
bugId => "12345678",
fileDescription => "trying to attach a file",
external => "false",
Filedata => [ "Path" ],
],
);