I have a script which sends the information of the form to the controller, but when using the value of the input file I get that the value of that field is null
"message": "Call to a member function store () on null "
<script>
function saveAbsence() {
$.ajax({
type: 'POST',
url: '{{url('/emp/newAbsence')}}',
data: {
absenceDate: $('#absenceDate').val(),
note: $('#note').val(),
absenceDateEnd: $('#absenceDateEnd').val(),
absenceFile: $('#absenceFile').val()
},
success: function (data) {
console.log( $('#absenceFile'))
// location.reload();
},
error: function (data) {
showAjaxErrors(data, 'error_msg');
markError(['absenceDate', 'absenceDateEnd', 'note']);
}
});
}
</script>
{{ Form::open(array('url' => '/saveAbsence'), ['id' => 'absenceForm'], ['enctype' => 'multipart/form-data'], ['files'=> true]) }}
<div class="row">
<div class="col-lg-10 col-md-10 col-sm-12">
<div class="form-group">
{{Form::file('image')}}
</div>
</div>
</div>
<div class="modal-footer">
{{ Form::button('Guardar', ['class' => 'btn btn-primary', 'onClick' => 'saveAbsence()']) }}
</div>