im try to upload image as data json in ajax method post not working in cpanel server but in localhost work

im use slim cropper image

when im try to insert data without image its work but when i insert image not working


        $(function(){ //begin::jquery reader

            $('#form-candidature').on('submit', function (e) {
            if (!e.isDefaultPrevented()){   
                    var dataForm = $("#form-candidature");
                    console.log($('input[name=slim]').val())
                    $.ajax({
                      url : "{{route('candidature.update',['id'=>$candidature->id])}}",
                      data: new FormData(dataForm[0]),
                      type : "POST",  
                      datatype: "JSON",
                      contentType: false,
                      processData: false,

                      success : function(data) {
                        console.log(data);
                            toastr.success(data.message, data.title);
                    },
                    error : function(data){
                        console.log(data);
                        requestValidationErrors(data);
                    }
                    });
                    return false;
                }
             });
        });//end::jquery reader


//route 
Route::post('profile/update/{id}',[
      'uses' => '[email protected]',
      'as' => 'candidature.update'
    ]);


this is the image value that i want send in ajax

{"server":null,"meta":{},"input":{"name":"index.jpg","type":"image/jpeg","size":3820,"width":267,"height":189,"field":null},"output":{"name":"index.jpg","type":"image/jpeg","width":189,"height":189,"image":"data:image/jpeg;base64,/9j/4AAQSkZJRgABAQAAAQABAAD..."},"actions":{"rotation":null,"crop":{"x":39,"y":0,"height":189,"width":189,"type":"auto"},"size":{"width":400,"height":400},"filters":{"sharpen":0},"minSize":{"width":0,"height":0}}}

when i submit the form with image i have this error MethodNotAllowedHttpException even i send everything with method post

0 Answers