从$\u文件存储的php数组

从$\u文件存储的php数组,php,arrays,Php,Arrays,你好,我有一个愚蠢的问题,我想上传一个文件到服务器。该过程可以工作,但我有多个文件输入字段,我想将它们的名称存储在数组中,但这不起作用-\ $target_dir = "../steppys/" . $id; $target_files = array(); $target_files[] = $target_dir . basename($_FILES["image1"]["name"]); echo $target_files[0]; 这就是代码,它将回显0; 但当这: $

你好,我有一个愚蠢的问题,我想上传一个文件到服务器。该过程可以工作,但我有多个文件输入字段,我想将它们的名称存储在数组中,但这不起作用-\

  $target_dir = "../steppys/" . $id;
  $target_files = array();
  $target_files[] = $target_dir . basename($_FILES["image1"]["name"]);
  echo $target_files[0];
这就是代码,它将回显0; 但当这:

$target_dir = "../steppys/" . $id;
echo $target_dir . basename($_FILES["image1"]["name"]);
它会给我路径名。我需要将它添加到一个数组中。 阵列也工作正常 我已经对它们进行了测试(还动态添加了一些东西)

Htmlcode(简单形式,但也经过测试):



提前感谢

是的,我解决了问题,我没有上传一个文件…

是的,我解决了问题,我没有上传一个文件…

您需要将文件输入视为数组/倍数和/或添加更多输入。手册上都有examples@Fred-你能给我举个例子吗?你需要把文件输入看作一个数组/倍数和/或添加更多的输入。手册上都有examples@Fred-你能给我举个例子吗?
<form enctype="multipart/form-data" action="test.php" method="post">
      <div class="form-group">
        <input class="form-control" type="file" name="image1" />
      </div>
      <input class="form-control" type="submit">
    </form>