title: Image validation not working If using ajaxForm
body: <p>I tried googling and saw other questions posted at this forum but could not find any solution for my issue. I am using Jquery <strong>ajaxForm</strong> method to submit form. My form contains one <strong>file</strong> field too in the form that can be used to upload a picture. I have defined the validation in my model. But the issue is even i am uploading a correct <code>jpg</code> file, still i am getting error message that </p>
  
  <pre><code>Argument 1 passed to Illuminate\\Validation\\Factory::make() must be of the type array, object given.
  </code></pre>
  
  <h2>Javascript Code</h2>
  
  <pre><code>$('#create_form').ajaxForm({
      dataType:'JSON',
      success: function(response){
          alert(response);    
      } 
  }).submit();
  </code></pre>
  
  <h2>Controllder Code</h2>
  
  <pre><code>if ($file = Input::file('picture')) {
      $validator = Validator::make($file, User::$file_rules);
  
      if ($validator-&gt;fails()) {
          $messages = $validator-&gt;messages();
          foreach ($messages-&gt;all(':message') as $message) {
              echo $message; exit;
          }
          return Response::json(array('message'=&gt;$response, 'status'=&gt;'failure'));
      } else {
          // do rest 
      }
  }
  </code></pre>
  
  <h2>Model Code</h2>
  
  <pre><code>public static $file_rules = array(
      'picture' =&gt; 'required|max:2048|mimes:jpeg,jpg,bmp,png,gif'
  );
  </code></pre>
  
  <h2>POST Request</h2>
  
  <p><img src="https://i.stack.imgur.com/DtOCS.png" alt="enter image description here"></p>
  
  <p>I know that my validation defined in the model expects an array. But by passing <code>$file</code> in the validator, an object is passed. Then i changed the code like:</p>
  
  <pre><code>$validator = Validator::make(array('picture' =&gt; $file-&gt;getClientOriginalName()), User::$file_rules);
  </code></pre>
  
  <p>Now i am getting error:</p>
  
  <pre><code>The picture must be a file of type: jpg, JPEG, png,gif.
  </code></pre>