如果我们进行文件上传和表单属性,我将获取表单数据值,如变量NULL
in 。%fdat
EmbPerl
enctype="multipart/form-data"
这是 EmbPerl 代码:
if(( defined $fdat{file} && $fdat{file} ) && $fdat{upload} )
{
$filename = "/tmp/sample.txt";<br/>
open (FILE, "> $filename") || die("open failed: $!");
while (read($fdat{file}, $buffer, 32768)) {
print FILE $buffer || die("print test: $!");
close FILE || die("close test: $!");
}
HTML代码是:
<form name="form1" method="post" enctype="multipart/form-data" onsubmit="return validation();>
<table>
<tr> <td>Select EXCEL sheet</td>
<td><input type="file" name="file" value=""></td>
</tr>
<tr>
<td> </td>
<td><input type="submit" name="upload" value="upload"></td>
</tr>
</table>
</form>
我正在使用 EmbPerl/2.3.0、CGI/3.63、Perl/5.10.1、Apache/2.2.22 和 Linux 操作系统。