Nov 10, 2022
0
Level 1
TypeError: Can only call Blob.slice on instances of Blob
ajax:
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
let inputWithFileID = $(input).attr('data-input-id');
let image = $('#' + inputWithFileID).prop('files');
$.ajax({
type: 'POST',
url: '/profile/edit/setBackground',
data: {
points: $('#bgImageCroppie').croppie('get'),
image: image
},
success: (data) => {
///
},
error: (data) => {
///
}
});
HTML:
<div class="mb-3">
<input class="form-control" type="file" onchange="previewImage(this);" data-preview-block-id="bgImageCroppie" id="bgFile" accept="image/png, image/jpeg">
</div>
<div class="col-12 text-end">
<button type="submit" class="btn btn-sm btn-primary mb-0" data-input-id="bgFile" onclick="setBackground(this)">Save</button>
</div>
An error: TypeError: Can only call Blob.slice on instances of Blob
I tried to use processdata:false and contenttype: false, but then an empty request came
Please or to participate in this conversation.