I am using laravel 5. I have did the following code to post data using json to my controller. But I cannot make file uploading by this manner.
e.preventDefault();
$.ajax({
type: 'POST',
cache: false,
dataType: 'JSON',
url: 'tasks',
data: $('#my_form').serialize(),
success: function(data) {
console.log(data);
},
});
I have the following html code to upload files.
<input type="text" name="name" value="" />
<input type="text" name="name" value="" />
<input type="file" class="form-control" name="documents[]" multiple>
How can I send file using json in laravel? I have did many search but I cant get proper solution