I have a form for add Hotel And I Want to select image for AnyHotel I use Ajax to save image directory But I Can not upload image in public\images
Directory,My Code is Here
in Blade:
<div class="form-group has-feedback has-feedback-left">
<input type="file" id="image">
</div>
<button type="submit"data-dismiss="modal"
id="AddHotel">Add hotel</button>
<script>
$('#AddHotel').click(function (event) {
var image = $('#image').val();
var city = $('#city').val();
$.post('/Add/Hotel', {
'image' : image,
'_token': $('input[name=_token]').val()
},
function (data) {
console.log(data);
window.location.reload();
});
});
</script>
And in Controller to save image directory I'm using this code:
public function Store(request $request)
{
$hotel->image = $request->image;
$hotel->save();
return $request->all();
}
My Problem is here That When I Print this image from DB image should be in public Directory,How I Can upload image in directory?