Laravel 5 Ajax File/Image Upload Laravel 5 Ajax File/Image Upload ajax ajax

Laravel 5 Ajax File/Image Upload


Two things to change:

Change your js file from:

 data:{    logo:new FormData($("#upload_form")[0]), },

To:

 data:new FormData($("#upload_form")[0]),

Because you would like to send the whole form.

In your html:

Add a name to your file input field

<input type="file" class="form-control" id="catagry_logo">

To:

<input type="file" name="logo" class="form-control" id="catagry_logo">


it doesn't work for me because of dataType:'json'. If anyone gets error just remove dataType:'json'.


Check in your controller what you get when you post:

echo dd(Input::all()); 

Check files object in php. This in PHP:

$_FILESRequest::file("logo");

Yeah, you're not really posting any data? Is the form really posting?