I have an individual html form for uploading photo on Laravel's blade and I am trying to post the image to the Controller.
The Html form looks like:
<form id="fileForm" enctype="multipart/form-data">
<input type="file" id="fileInput" name="fileInput" style="visibility: hidden"/>
<input type="button" value="submit" id="ajaxSubmit" hidden />
</form>
And in (document.ready):
jQuery('input[type=file]').change(function() {
jQuery('#fileForm').submit();
});
jQuery('#fileForm').on('submit',(function(e) {
e.preventDefault();
jQuery.ajax({
url: '',
type: 'POST',
data: new FormData(jQuery(this)[0]),
processData: false,
success: function (data) {
},
complete: function() {
}
})
}))
When I dd(Input:all());
on the controller, it shows this and so on:
However, dd(Input::file('fileInput))
returns null.
When I try dd(Input::hasFile('fileForm'));
(which I feel it is not correct), it returns false