1
업로드 파일에 ngFileUpload를 사용하지만 파일을 하나만 업로드 할 수 있습니다.AngularJS에서 여러 파일을 업로드하는 방법
이미지 파일 및 PDF 파일을 업로드하고 싶습니다. 멀티 파일을 업로드하는 방법은 무엇입니까?
도와주세요.
업로드 파일에 ngFileUpload를 사용하지만 파일을 하나만 업로드 할 수 있습니다.AngularJS에서 여러 파일을 업로드하는 방법
이미지 파일 및 PDF 파일을 업로드하고 싶습니다. 멀티 파일을 업로드하는 방법은 무엇입니까?
도와주세요.
당신은 당신이 그 2 입력 필드를 결합하여 입력 태그에 여러 속성을 추가 할 수 있습니다 동시에 여러 파일을 업로드하려면
(function() {
'use strict';
var app = angular.module('pageApp', ['ngFileUpload']);
app.controller('MyCtrl', ['$scope', 'Upload', '$timeout', function ($scope, Upload, $timeout) {
$scope.uploadPic = function (file) {
file.upload = Upload.upload({
url: 'save_form.php',
data: {
file: file,
username: $scope.username
},
});
file.upload.then(function (response) {
$timeout(function() {
file.result = response.data;
});
}
};
}]);
})();
<form name="myForm">
Profile Picture: <input type="file" ngf-select="" ng-model="picFile" name="file" ngf-accept="'image/*'">
<br>
Resume(.pdf): <input type="file" ngf-select="" ng-model="resumeFile" name="fileResume">
<br>
<button ng-disabled="!myForm.$valid" ng-click="uploadPic(picFile)">Submit</button>
</form>
<form name="myForm">
Picture & Resume: <input type="file" ngf-select=""
ng-model="picFile" name="file" ngf-pattern="'image/*,application/pdf'" multiple>
<br>
<button ng-disabled="!myForm.$valid" ng-click="uploadPic(picFile)">Submit</button>
</form>
프로필 사진을 업로드하고 두 번 모두 다시 시작 하시겠습니까? – digit
예, 프로필 사진을 업로드하고 두 번 다시 시작합니다. – Rain