title: Upload multiple files in Laravel 4
body: <p>Here is my controller code for uploading multiple files and I am passing key and value from 'postman' rest API client on Google Chrome. I am adding multiple files from postman but only 1 file is getting upload.</p>
  
  <pre><code>public function post_files() {
      $allowedExts = array("gif", "jpeg", "jpg", "png","txt","pdf","doc","rtf","docx","xls","xlsx");
      foreach($_FILES['file'] as $key =&gt; $abc) {
          $temp = explode(".", $_FILES["file"]["name"]);
          $extension = end($temp);
          $filename= $temp[0];
          $destinationPath = 'upload/'.$filename.'.'.$extension;
  
          if(in_array($extension, $allowedExts)&amp;&amp;($_FILES["file"]["size"] &lt; 20000000)) {
              if($_FILES["file"]["error"] &gt; 0) {
                  echo "Return Code: " . $_FILES["file"]["error"] . "&lt;br&gt;";
              }
              if (file_exists($destinationPath)) {
                  echo $filename." already exists. ";
              } else {
                  $uploadSuccess=move_uploaded_file($_FILES["file"]["tmp_name"],$destinationPath);
                  if( $uploadSuccess ) {
                      $document_details=Response::json(Author::insert_document_details_Call($filename,$destinationPath));
                      return $document_details; // or do a redirect with some message that file was uploaded
                  // return Redirect::to('authors')
                  } else {
                      return Response::json('error', 400);
                  }
              }
          }
      }  
  }
  </code></pre>
  
  <p>I have tried this code also but it returns me location of a file in temporary folder</p>
  
  <pre><code>$file = Input::file('file');
              echo count($file);
  </code></pre>
  
  <p>and
   <code>echo count($_FILES['file']);</code>
  returns me always 5.Can anyone tell me why?</p>
  
  <p>and why <code>foreach(Input::file('file') as $key =&gt; $abc)</code>  gives the error invalid arguments</p>