如何从多维数组上载文件

时间:2019-05-27 02:34:46

标签: php mysql

有人可以帮助我吗?我正在尝试更新MYSQL DB中的文件并将上载的文件移动到文件夹“ upload / documents /”,但是我似乎无法在docUpload中获取文件。我不断收到此通知:C:中的未定义索引:“ docfile”。谁能帮帮我吗。这是我的$ _files的var_dump:

    Array
    (
        [name] => Array
            (
                [1001] => Array
                    (
                        [101] => Array
                            (
                                ['docUpload'] => test.txt
                            )

                        [1010] => Array
                            (
                                ['docUpload'] => test 2.txt
                            )

                    )

                [901] => Array
                    (
                        [701] => Array
                            (
                                ['docUpload'] => test 3.txt
                            )

                        [901] => Array
                            (
                                ['docUpload'] => 
                            )

                    )

            )

        [type] => Array
            (
                [1001] => Array
                    (
                        [101] => Array
                            (
                                ['docUpload'] => text/plain
                            )

                        [1010] => Array
                            (
                                ['docUpload'] => text/plain
                            )

                    )

                [901] => Array
                    (
                        [701] => Array
                            (
                                ['docUpload'] => text/plain
                            )

                        [901] => Array
                            (
                                ['docUpload'] => 
                            )

                    )

            )

        [tmp_name] => Array
            (
                [1001] => Array
                    (
                        [101] => Array
                            (
                                ['docUpload'] => C:\xampp\tmp\php16C8.tmp
                            )

                        [1010] => Array
                            (
                                ['docUpload'] => C:\xampp\tmp\php16C9.tmp
                            )

                    )

                [901] => Array
                    (
                        [701] => Array
                            (
                                ['docUpload'] => C:\xampp\tmp\php16CA.tmp
                            )

                        [901] => Array
                            (
                                ['docUpload'] => 
                            )

                    )

            )

        [error] => Array
            (
                [1001] => Array
                    (
                        [101] => Array
                            (
                                ['docUpload'] => 0
                            )

                        [1010] => Array
                            (
                                ['docUpload'] => 0
                            )

                    )

                [901] => Array
                    (
                        [701] => Array
                            (
                                ['docUpload'] => 0
                            )

                        [901] => Array
                            (
                                ['docUpload'] => 4
                            )

                    )

            )

        [size] => Array
            (
                [1001] => Array
                    (
                        [101] => Array
                            (
                                ['docUpload'] => 0
                            )

                        [1010] => Array
                            (
                                ['docUpload'] => 0
                            )

                    )

                [901] => Array
                    (
                        [701] => Array
                            (
                                ['docUpload'] => 0
                            )

                        [901] => Array
                            (
                                ['docUpload'] => 0
                            )

                    )

            )

    )

这是我到目前为止所做的:

        $producySelected = $_FILES['docUpload']; 
        if(!empty($producySelected))
        {
            $icount = 0;
            foreach($producySelected as $key=>$selected)
            {
                $icompte = 0;
                foreach($selected as $keyz=>$value)
                {
                    echo "<pre>";
                    echo($key);
                    echo "<br>";
                    echo($keyz);
                    echo "<br>";
                    echo ($value["'docUpload'"]); ??
                    echo "<br>";
                    echo "</pre>";
                $icompte++; 
                }
            $icount++;
            }
        }

0 个答案:

没有答案