title: json decode file names when uploading multiple images and loop through them
body: <p>I am using a plugin ( I would have checked the manual if there was one for this) that already json_encodes() the file names when uploading multiple images. The only help I have so far works for one image only. </p>
  
  <pre><code>$response = array();
  $message = "";
  
  $files = $_POST['files']; 
  
      foreach (json_decode($files) as $key =&gt; $value) { 
  
       $image = $value-&gt;file_name; 
  
  } 
  
  
  if($_POST['files'] == "[]") { 
  
      $message .= "At least one image required";  
  
      } 
  
      if($message) { 
  
          $response['success'] = false; 
          $response['message'] = $message; 
  
      } else { 
  
          $response['success'] = true; 
          $response['message'] = $image; 
      } 
  
      echo json_encode($response);
  </code></pre>
  
  <p>This is the jquery/ajax</p>
  
  <pre><code>var uploader = $('.picker-uploader').uploader({
                  upload_url: 'upload.php',
                  file_picker_url: 'files.php',
                  input_name: 'file',
                  maximum_total_files: 5,
                  maximum_file_size: 50009000,
                  file_types_allowed: ['image/jpeg', 'image/png'],
                  on_error: function(err) {
                      swal({
                          title: "Upload Failed",
                          text: err.messages,
                          type: "warning"
                      })
                  }
              })
  
  $( "#edit_pic" ).on("click", function(e) {
          e.preventDefault();
           var files = $('input[name="file"]').val();
  
          $.ajax({
              url: 'functions/add-support-images.php',
              type: 'POST',
              dataType: 'json',
              data: {files: files},
              beforeSend: function() {
                  $( "#edit_pic" ).prop("disabled", true).html("Uploading...");
              },
          })
  
          .done(function(data) {
                  if(!data.success) {
                  console.log(data.message);
  
              } else {
  
                  alert(data.message);
              }
      })
  </code></pre>
  
  <p>The upload button is in a tab:</p>
  
  <pre><code>&lt;div id="addimages" class="tab-pane"&gt;
      &lt;div class="form-group"&gt;
          &lt;p&gt;&lt;/p&gt;
          &lt;label&gt;Additional Images&lt;/label&gt;
          &lt;p&gt;&lt;/p&gt;
          &lt;button type="button" class="picker-uploader btn btn-primary"&gt;Select images&lt;/button&gt;
      &lt;/div&gt;
      &lt;p&gt;&lt;/p&gt;
      &lt;button type="submit" name="edit_pic" class="btn btn-fill btn-info" id="edit_pic"&gt;Update&lt;/button&gt;
      &lt;p&gt;&lt;/p&gt;
      &lt;div class="alert alert-danger" id="image_error"&gt;&lt;/div&gt;
      &lt;div class="alert alert-success" id="image_success"&gt;&lt;/div&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I then want to json_encode() that again but if I choose more than one file it only outputs the last uploaded file. I need to loop through $image as well but not sure how to achieve that. </p>