国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

angular.js - Angular $http() 無法發(fā)送dataURI數(shù)據(jù)
習(xí)慣沉默
習(xí)慣沉默 2017-05-15 16:59:54
0
1
619

使用 ngImgCrop 插件,生成 base64 數(shù)據(jù)。使用 $http.post() 傳遞 base64 數(shù)據(jù)時,發(fā)生 414 錯誤,提示參數(shù)太大。
求解決的辦法,不想用 原生的 ‘form post’ 請求。在線等...

//*** 省略URL ***//
....
//----參數(shù)
_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
});
習(xí)慣沉默
習(xí)慣沉默

全部回復(fù)(1)
習(xí)慣沉默

你怎么發(fā)的???上代碼

補充

從你的代碼上看,你的做法就是把參數(shù)排在了URL的后面,類似:

xxx-url?image_url=mmmm&name=nnnn

但是post請求最好把參數(shù)放在requestBody里,代碼比你想象的更簡單:

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

這樣就好了

最新下載
更多>
網(wǎng)站特效
網(wǎng)站源碼
網(wǎng)站素材
前端模板