您的位置:首页 > 编程语言 > PHP开发

php多文件上传数组 转换

2014-08-21 11:32 381 查看
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<body>

<form action="" method="post" enctype ="multipart/form-data">
<input name="UpLoadFile[]" type="file" value="1"/>
<input name="UpLoadFile[]" type="file" value="2"/>
<input name="UpLoadFile[]" type="file" value="3"/>

<input name="aa[]" type="hidden" value="2"/>
<input name="aa[]" type="hidden" value="3"/>

<input type="submit" name="Button1" value="Button" id="Button1" />
</form>

</body>
</html>

<?php

print_r($_FILES['UpLoadFile']);

$arr = array();

if(!empty($_FILES['UpLoadFile'])){

foreach($_FILES['UpLoadFile'] as $k=>$v){
foreach($v as $kk=>$vv){
if($kk==$kk){
$arr[$kk][$k] = $vv;
};
}
}
print_r($arr);
exit();
}

print_r($_POST);
print_r($_FILES);

?>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: