0
일부 요소를 S3에 업로드하고 있습니다. 작동,이 시점에서파일 업로드 게시글에서 URL 가져 오기
myApp.controller('myCtrl', ['$scope', 'fileUpload', function($scope, fileUpload){
$scope.uploadFile = function(){
var file = $scope.myFile;
console.log('file is ');
console.dir(file);
var uploadUrl = "/fileUpload";
fileUpload.uploadFileToUrl(file, uploadUrl);
};
을,하지만 지금은, 내가 업로드 한 파일의 URL을 잡을 필요가 :이 링크의 내부 같은 예를 사용하고 있습니다. 내가 어떻게 할 수 있니? 새로운 업로드 파일 :/
myApp.service('fileUpload', ['$http', function ($http) {
this.uploadFileToUrl = function(file, uploadUrl){
var fd = new FormData();
fd.append('file', file);
$http.post(uploadUrl, fd, {
transformRequest: angular.identity,
headers: {'Content-Type': undefined}
})
.success(function(){
})
.error(function(){
});
}
}]);
고지
은'.success'와는'.error' 방법이 사용되지 않습니다. 자세한 내용은 [왜 $ $ 성공/오류 메서드가 더 이상 사용되지 않습니다? v1.6에서 삭제?] (https://stackoverflow.com/questions/35329384/why-are-angular-http-success-error-methods-deprecated-removed-from-v1-6/35331339#35331339). – georgeawg