title: Laravel 5 Ajax File/Image Upload
body: <p>I have an issue in my laravel ajax application,</p>
  
  <p>I cant upload images/files through ajax POST.</p>
  
  <p>here is my code.</p>
  
  <p>Ajax..</p>
  
  <pre><code>/*Add new catagory Event*/
  $(".addbtn").click(function(){
  $.ajax({
        url:'add-catagory',
        data:{
          logo:new FormData($("#upload_form")[0]),
          },
        dataType:'json',
        async:false,
        type:'post',
        processData: false,
        contentType: false,
        success:function(response){
          console.log(response);
        },
      });
   });
  /*Add new catagory Event*/
  </code></pre>
  
  <p>Blade template ...</p>
  
  <pre><code> &lt;form enctype="multipart/form-data" id="upload_form" role="form" method="POST" action="" &gt;
        &lt;div class="form-group"&gt;
          &lt;label for="catagry_name"&gt;Name&lt;/label&gt;
           &lt;input type="hidden" name="_token" value="{{ csrf_token()}}"&gt;
          &lt;input type="text" class="form-control" id="catagry_name" placeholder="Name"&gt;
          &lt;p class="invalid"&gt;Enter Catagory Name.&lt;/p&gt;
        &lt;/div&gt;
        &lt;div class="form-group"&gt;
          &lt;label for="catagry_name"&gt;Logo&lt;/label&gt;
          &lt;input type="file" class="form-control" id="catagry_logo"&gt;
          &lt;p class="invalid"&gt;Enter Catagory Logo.&lt;/p&gt;
      &lt;/div&gt;
  
      &lt;/form&gt;
      &lt;/div&gt;
      &lt;div class="modelFootr"&gt;
        &lt;button type="button" class="addbtn"&gt;Add&lt;/button&gt;
        &lt;button type="button" class="cnclbtn"&gt;Reset&lt;/button&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  </code></pre>
  
  <p>Controller ..</p>
  
  <pre><code>public function catadd(){
      if (Input::hasFile('logo'))
      {
         return "file present";
      }
      else{
          return "file not present";
      }
  }
  </code></pre>
  
  <p>Route ..</p>
  
  <pre><code> Route::post('add-catagory',['as'=&gt;'catagory_add','uses'=&gt;'MastersController@catadd']);
  </code></pre>
  
  <p>What is the error in my code ???</p>
  
  <p>I cant get the file information in laravel controller..</p>
  
  <p>How can i solve this issue...?</p>