php多个文件上传错误

时间:2017-10-10 15:51:07

标签: php file upload multiple-file-upload

我想根据乘客人数上传多个文件 但是当我使用数组时它根本不起作用

<?php for ($i = 0; $i < $_REQUEST[select_child]+$_REQUEST[select_adult]; $i++){?>
                        <input type="file" name="scannedFile[]" multiple="multiple" size="40">
                    <?php }?>

$ data [3]是$ _REQUEST [select_child],$ data [4]是$ _REQUEST [select_adult]。

for ($i = 1; $i <= $data[3]+$data[4]; $i++){
            $rename = date("YmdHis") . '_' . $_FILES['scannedFile']['name'][$i];
            $target_path = "admin/images/uploads/" .$rename;
            move_uploaded_file($_FILES['scannedFile']['tmp_name'][$i], $target_path);
            echo $rename;
        }

问题是什么??

1 个答案:

答案 0 :(得分:0)

也许很明显,但是,你是否在表单标签中设置了enctype?

enctype="multipart/form-data"