HTML 5 multi file upload with PHP

瘦欲@ 提交于 2019-11-27 13:19:19

Try

foreach ($_FILES['imageURL'] as $file) { 
    echo $file['name'];
}

UPDATE:

Google found this tutorial which may help you

Instead of using for() and recounting the number of items in the array, you can use a more elegant foreach()

$files=array();
$fdata=$_FILES['file'];
if(is_array($fdata['name'])){
    foreach ($fdata['name'] as $i => $d) {
        $files[] = array(
        'name' => $d,
        'tmp_name' => $fdata['tmp_name'][$i]
        );
    }
}
else $files[]=$fdata;

Maybe I'm wrong, but wouldn't setting multiple="" turn multiple uploads off? Just use multiple by itself, as shown in the HTML5 spec or, for XHTML compatibility, multiple="multiple":

<input type="file" name="imageURL[]" id="imageURL" multiple />
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!