angular.js - Angular $http() cannot send dataURI data
習慣沉默
習慣沉默 2017-05-15 16:59:54
0
1
576

Use the ngImgCrop plug-in to generate base64 data. When using $http.post() to pass base64 data, a 414 error occurs, indicating that the parameter is too large.
Looking for a solution, I don’t want to use 原生的 ‘form post’ 请求. Waiting online...

//*** 省略URL ***//
....
//----参数
_params={image_url:$scope.cropper.croppedImage,name:_form.name}
//----请求
$http({
    method:"POST",
    url:_url,
    params:_params,
    headers:{'Content-Type':'application/x-www-form-urlencoded'},
    transformRequest:angular.identity
});
習慣沉默
習慣沉默

reply all(1)
習慣沉默

How did you post it? Up code

Supplement

Judging from your code, your approach is to put the parameters after the URL, similar to:

xxx-url?image_url=mmmm&name=nnnn

But postit is best to put the parameters in the requestBody. The code is simpler than you think:

$http({
    method: "POST",
    url: _url,
    data:_params
});

That’s good

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template