im尝试在ajax方法发布中将图像作为数据json上载在cpanel服务器中不起作用,但在localhost工作中
使用苗条的裁剪图像
当我尝试在没有图像的情况下插入数据但在我插入图像不起作用时
$(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' => 'CandidatureController@profileUpdate',
'as' => 'candidature.update'
]);
这是我要在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}}}
当我提交带有图像的表单时,即使我使用方法post发送所有内容,也会出现此错误MethodNotAllowedHttpException