Firefox 3.6引入了[常规类型="文件"输入元素的多个属性]( http://hacks.mozilla.org/2009/12/multiple-file-input-in-firefox-3-6/).
我不能让Perl处理这些字段.我可以在列表上下文中调用该字段,如下所示:
my @files = $CGIobject->param("File_Input");
Run Code Online (Sandbox Code Playgroud)
通过它循环将给我文件名作为字符串,但没有别的.
任何建议都会受到欢迎.
这是HTML:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Multiple file upload test</title>
</head>
<body>
<form action="deliberately_obfuscated"
method="post"
enctype="multipart/form-data">
<input type="file"
name="multiple_files"
multiple="true"/>
<button type="submit">Submit</button>
</form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这是Perl:
#!/usr/bin/perl
#use strict;
#use warnings;
use CGI;
my $CGIo = new CGI;
print $CGIo->header();
@lightweight_fh = $CGIo->upload('myfiles');
# undef may be returned
# if it's not a
# valid file handle
if (@lightweight_fh) {
# Upgrade the handle …Run Code Online (Sandbox Code Playgroud)