title: array_keys() expects parameter 1 to be array, null given
body: <p>I've got a problem with my code that I've been struggling with. I just can't figure out what causes this error. </p>
  
  <p>So, I made an upload form in my CMS. If I upload 9 photos, it works fine. If I upload beyond 9 files, it gives me this error:</p>
  
  <pre><code>array_keys() expects parameter 1 to be array, null given in C:...upload.php on line 18
  </code></pre>
  
  <p>Can somebody help me out?</p>
  
  <p>Code:</p>
  
  <pre><code>$file_ary = reArrayFiles($_FILES['ufile']);
    //Reorganising the $_FILES:
  
    function reArrayFiles(&amp;$file_post) {
  
        $file_ary = array();
        $file_count = count($file_post['name']);
        $file_keys = array_keys($file_post);
  
        for ($i=0; $i&lt;$file_count; $i++) {
            foreach ($file_keys as $key) {
                $file_ary[$i][$key] = $file_post[$key][$i];
            }
        }
  
        return $file_ary;
    }
  
  
    foreach ($file_ary as $file) {
        $dir = "imgs/" . $last_fotoid . "/";
  
        if (!file_exists($dir)) {
          mkdir("imgs/" . $last_fotoid . "/");
        }
  
  
        $target_file = $dir . basename($file["name"]); 
  
        move_uploaded_file($file["tmp_name"], $target_file);
  
  }
  </code></pre>
  
  <p>My form:</p>
  
  <pre><code>&lt;form  method="post" action="upload.php" enctype="multipart/form-data"&gt;
            Select image to upload:&lt;br&gt;
            &lt;input type="file" name="ufile[]" multiple&gt;
            &lt;input type="submit" value="Upload Image" name="submit"&gt;
  &lt;/form&gt; 
  </code></pre>