如何使 WWW::Mechanize 以不同的文件名上传文件?
我希望网络服务器查看/记录与我计算机上的文件名不同的文件名。
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
您可以使用硬链接:
link "file_name_on_your_computer","desired_new_name";
# Code to upload the newly created link
unlink "desired_new_name";
笔记