Govind M
Govind M

Reputation: 51

Ajax Request with Image base64 shows 403 Forbidden in Laravel

I am trying to crop and upload image with croppie plugin. The code is working fine on local server, but when I upload it on live server and upload an image, the POST URL shows 403 (Forbidden). I tried to search the solution online but could not find anything helpful. Can someone help me, the ajax request code is:

$('#cropImageBtn').on('click', function (ev) {

    $uploadCrop.croppie('result', {
        type: 'canvas',
        size: 'viewport'
    }).then(function (resimg) {
    $.ajax({
        url: "{{ route('profile.uploadimage') }}",
        type: "POST",
        data: {"image": resimg},
        success: function (res) {

            $('#item-img-output').attr('src', resimg);
            $('#cropImagePop').modal('hide');

            swal(
            {
                title: res.title,
                text: res.text,
                type: res.type,
                allowOutsideClick: false
            }).then(                    
                function(){ 
                   location.reload();
               }
            );
            }
        });           
    });
});

Upvotes: 2

Views: 452

Answers (0)

Related Questions