使用 ngImgCrop
插件,生成 base64
數(shù)據(jù)。使用 $http.post()
傳遞 base64
數(shù)據(jù)時(shí),發(fā)生 414
錯(cuò)誤,提示參數(shù)太大。
求解決的辦法,不想用 原生的 ‘form post’ 請(qǐng)求
。在線等...
//*** 省略URL ***//
....
//----參數(shù)
_params={image_url:$scope.cropper.croppedImage,name:_form.name}
//----請(qǐng)求
$http({
method:"POST",
url:_url,
params:_params,
headers:{'Content-Type':'application/x-www-form-urlencoded'},
transformRequest:angular.identity
});
你怎么發(fā)的???上代碼
從你的代碼上看,你的做法就是把參數(shù)排在了URL的后面,類似:
xxx-url?image_url=mmmm&name=nnnn
但是post
請(qǐng)求最好把參數(shù)放在requestBody里,代碼比你想象的更簡單:
$http({
method: "POST",
url: _url,
data:_params
});
這樣就好了