var fd = new FormData();
fd.append("文件名",$files[0]);
$http({
method: 'post',
url: '上传URL地址',
data:fd,
headers: {'Content-Type': undefined},
transformRequest: angular.identity,
uploadEventHandlers: {
progress: function(e) {
if (e.lengthComputable) {
vm.currentProcess = Math.round(e.loaded * 100 / e.total);
if (e.loaded == e.total) {
//上传完成 } } } } }).success(function(ret) { }).error(function(ret) { })
原文链接:https://www.f2er.com/angularjs/146634.html