title: AJAX file upload in laravel
body: <p>I've been trying to get ajax file upload working in lavavel 4 since last two days and I'm soo out of luck right now.</p>
  
  <p>my jquery block </p>
  
  <pre><code>$(document).ready(function(){
  
  $('#basicModuleImage').change(function () {
      sendFile(this.files[0]);
  });
  
  function sendFile(file) {
  
    $.ajax({
      type: 'post',
      url: '/upload',
      data: file,
      enctype: 'multipart/form-data',
      success: function (data) {
              alert(data);
      },
      processData: false,
      contentType: file.type
    });
  }
   });
  </code></pre>
  
  <p>HTML block</p>
  
  <pre><code> &lt;form method="post" action=""&gt;
   &lt;input type="file" id="basicModuleImage" name="basicModuleImage" /&gt;
   &lt;/form&gt;
  </code></pre>
  
  <p>LARAVEL PHP block</p>
  
  <pre><code>Route::post('upload', function(){
  
  return Response::json(array('a'=&gt;var_dump(Input::all()),'b'=&gt;var_dump($_FILES)));
  
  });
  </code></pre>
  
  <p>I also tried using <a href="https://github.com/LPology/Simple-Ajax-Uploader" rel="nofollow">https://github.com/LPology/Simple-Ajax-Uploader</a> but it seems a problem with laravel.</p>
  
  <p>JSON response returns a and b both null.</p>