我想向我的服務器發送一個頭像,但是我有這個錯誤「您必須在您的POST表單數據中包含'頭像'文件var。」如何使用Angular發佈數據作爲表單數據
function getPictureSuccess(imageData) {
var image = "data:image/jpeg;base64," + imageData;
$scope.avatar = image;
}
$http({
url: api_url + 'userplus/avatar_upload/?key=' + api_key + '&cookie=' + dataCookie,
method:"POST",
headers : {'Content-Type': 'application/x-www-form-urlencoded'},
data: {avatar: avatar}
});
數據:{頭像:$ scope.avatar} –