PHP:上传更多文件

时间:2015-07-17 16:01:47

标签: php file-upload upload

请帮我解决我的PHP上传问题:

我的代码:

<?php
 if(isset($_POST['uploadsubmit'])) {
  for($i=0; $i<count($_FILES['upload']['name']); $i++) {
  //Get the temp file path
  $tmpFilePath = $_FILES['upload']['tmp_name'][$i];

  //Make sure we have a filepath
   if ($tmpFilePath != ""){
    //Setup our new file path
    $newFilePath = "./images/" . $_FILES['upload']['name'][$i];

    //Upload the file into the temp dir
    if(move_uploaded_file($tmpFilePath, $newFilePath)) {

      //Handle other code here

    }
   }
  }
 }
?> 

<form action="#" method="post" name="uploadimg"> 
<input type="file" name="upload[]" /><br />
<input type="file" name="upload[]" /><br /><br />
<input type="submit" name="uploadsubmit" value="Submit">
</form> 

我的问题是:

  

注意:未定义的索引:上传   第71行的C:\ web \ php_structure \ type \ article.php

第71行:

  for($i=0; $i<count($_FILES['upload']['name']); $i++) {

并且不执行上传。 在php.ini中上传是开启

...谢谢

0 个答案:

没有答案