html:
<form action="4.php" method="post" enctype="multipart/form-data">
<input type="file" name="images[]" multiple="true"/><input type="submit" name="pass" value="submit">
</form>
php:
print_r($_FILES);
$e=0;
foreach ($_FILES['images']['tmp_name'] as $d){
move_uploaded_file($d,'../packaging/image/2/'.$count.'/'.$e.'.jpg');
$e++;
}
以上参考输出:
Array(
[images] => Array (
[name] => Array ( [0] => productarrow1.jpg [1] => productarrow2.jpg )
[type] => Array ( [0] => image/jpeg [1] => image/jpeg )
[tmp_name] => Array ( [0] => D:\xamppe\tmp\php92A6.tmp [1] => D:\xamppe\tmp\php92A7.tmp )
[error] => Array ( [0] => 0 [1] => 0 )
[size] => Array ( [0] => 2477 [1] => 2436 )
)
)
鉴于网上很多 以添加input的办法来实现同时上传,并且写了一堆代码。
表示是坑
做web的有点浮躁