您好我正在尝试上传angularjs中的多个文件。我无法上传多个文件,因为它给我错误eferenceError:$ upload未定义 这是我的HTML代码。
<div class="upload-button" ng-repeat="file in files">
<div class="upload-button-icon">
<img src="images/folder-small.png">
<div class="upload-text">{{file}}</div>
<input type="file" id="file1" name="file1" />
</div>
</div>
<input type="submit" value="{{ 'NEXT' | translate }}" class="blue-button" ng-click="upload()">
以下是我上传文件的angularjs代码。
$scope.upload = function () {
debugger;
var fileuploadurl = baseurl + 'api/Customer/UploadLeaseFiles/' + LoginID + '/' + "GOSI";
for (var i = 0; i < $scope.files.length; i++) {
var $file = $scope.files[i];
$upload.upload({
url: fileuploadurl,
file: $file,
progress: function (e) {
// wait...
}
})
.then(function (data, status, headers, config) {
alert('file is uploaded successfully');
});
}
alert('file is uploaded successfully');
};
上面的代码给我错误$ upload未定义。我可以在上面的代码中知道我在哪里做错了吗?任何帮助,将不胜感激。谢谢。