我正在尝试将文件从Angularjs上传到webapi 然后完成上传我的网页刷新
这是我的服务
this.setImage = function(file , refModuleId , moduleTypeId)
{
var url = urlApiFileStorage + "api/FileStorage/SetImage";
var deferred = $q.defer();
var fd = new FormData();
fd.append('file', file);
fd.append('refModuleId', refModuleId);
fd.append('moduleType', moduleTypeId);
$http({
method: "POST",
url : url,
data : fd,
async: false,
crossDomain: true,
headers : {
'cache-control': 'no-cache',
'Authorize' : sessionStorage['Authorize'],
'Content-Type' : undefined
}
}).then(function(result) {
deferred.resolve(result);
}, function(result) {
deferred.reject('ERROR');
});
return deferred.promise;
};