angularjs $http file图片上传
$http({
url: API_URL+'uploadimage',
method: 'POST',
headers: {
'Content-Type': undefined
},
transformRequest: function() {
var formData = new FormData();
formData.append('file', $('#upfile')[0].files[0]);
return formData;
}
}).success(function (data) {
console.log(data); //返回上传后所在的路径
});