如何以不同的文件名制作WWW :: Mechanize上传文件?
我希望网络服务器能够在我的计算机上查看/记录与文件名不同的文件名。
答案 0 :(得分:4)
my $file = [
'filename-on-disk.txt', # The file you'd like to upload.
'filename-for-upload.txt', # The filename you'd like to give the web server.
'Content-type' => 'text/plain' # Any other flags you'd like to add go here.
];
$mech->post("http://example.com/upload.cgi", [
'upload' => $file
]);
取自: https://gist.github.com/gaurav/253111#file-file-upload-pl
答案 1 :(得分:0)
您可以使用硬链接:
link "file_name_on_your_computer","desired_new_name";
# Code to upload the newly created link
unlink "desired_new_name";
备注强>