2 回答
TA贡献1876条经验 获得超5个赞
是的,你可以做到。请记住,$_FILES将如下所示:
Array
(
[document_upload] => Array
(
[name] => Array
(
[one] => file1
[two] => file2
)
[type] => Array
(
[one] => type1
[two] => type2
)
[tmp_name] => Array
(
[one] => temp1
[two] => temp2
)
[error] => Array
(
[one] => 0
[two] => 0
)
[size] => Array
(
[one] => size1
[two] => size2
)
)
)
因此,要处理它们,您必须执行以下操作:
foreach ($_FILES['document_upload']['name'] as $fieldname => $filename) {
echo "File {$filename}; Size: {$_FILES['document_upload']['size'][$fieldname]}\n";
}
TA贡献1873条经验 获得超9个赞
您可以使用此代码。
Html(看空方括号):
<input type="file" name="document_upload[]" />
<input type="file" name="document_upload[]" />
通过这种方式,PHP 会将document_upload输入视为一个数组。
PHP代码:
foreach($_FILES["document_upload"] as $doc_upload) {
// $doc_upload is one of the file you uploaded
}
- 2 回答
- 0 关注
- 146 浏览
添加回答
举报