doushi1510 2015-02-04 22:04
浏览 31

未定义的偏移? 1个死语句后回显$ _POST

I am trying to upload a file through the POST array, with the 'newFile' name from the input tag being the index in the $_POST array that contains the name of the file I am uploading. I also have a dropdown list with a different name value of 'existingFile'. When I throw a die statement on my destination location, using print_r to look at the POST array, I find that it is missing the newFile index, still has the default value of the existingFile index, and has a random '1' displaying after the rest of the array is finished with the print_r function.

<form data-ajax="false" id="formFileSubmit" method="post" action="echo.php" enctype="multipart/form-data">
                    <!-- Restrict file uploads that will fail -->
                    <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
                    <!-- Name of input element for upload determines name in the $_FILES array -->
                    <input id="fileSelect" type="file" name="newFile" onChange="checkIfFile()" />
                    <select id="loadFile" data-role="button" type="file" name="existingFile" data-native-menu="false" onChange="previousFile()">
                        <!-- Add dropdown items for every file in the uploads directory, based on Title csv file metadata -->
                        <option name="loadList" id="defaultLoad" value="default" selected="selected">Choose a previously saved file...</option>
                        <?php
                        //Generate options for selection list based on previously saved files
                           $dir = 'uploads';
                           $files = scandir($dir, 1);
                           $j = 0;
                           foreach($files as $fileName/* File in directory */){
                                if($files[$j] == 'about_uploads_folder.txt.txt' || $files[$j] == '.' || $files[$j] == '..'){
                                    //Don't add a load option
                                }else{
                                    echo "<option name='load' value='".$fileName."'>".$fileName."</options>";
                                    echo '<br />';
                                }
                                $j++;

                           }
                        ?>

What is this undefined offset error, and how do I get the 'newFile' index to show up?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 公交车和无人机协同运输
    • ¥15 stm32代码移植没反应
    • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
    • ¥100 连续两帧图像高速减法
    • ¥15 如何绘制动力学系统的相图
    • ¥15 对接wps接口实现获取元数据
    • ¥20 给自己本科IT专业毕业的妹m找个实习工作
    • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
    • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)
    • ¥50 mac mini外接显示器 画质字体模糊