I have written some watermark code in Laravel and it is working fine. But now I want to show the preview before submitting the file. But I am getting error "POST 419 (unknown status)"
My view source code is
<form class="form-horizontal" method="POST" action="{{ route('announcement.store') }}" enctype="multipart/form-data">
{{ csrf_field() }}
<label for="description">Description</label>
<textarea id="my-editor" class="textarea" name="description" ></textarea>
<label for="image">Featured Image</label>
<input type="file" id="image" name="image">
<button type="submit" class="btn btn-success">Submit</button>
</form>
Javascript code
$(document).ready(function() {
$("#image").change(function(e) {
var image = $('#image').val();
$.ajax({
type: 'POST',
url:'{{url('/my-admin/imageupload')}}',
data: {image:image},
success: function( msg ) {
alert(msg);
},
error: function( data ) {
alert(data);
}
});
});
In this code, when I change the image I get error. I have done some watermark on image and save that image in folder. Now, I need to show that image on preview before submitting the form.