Hi i am developing file upload module using Angularjs and api. I am following https://jsfiddle.net/JeJenny/vtqavfhf/. I have one list which contains document names such as passport,visa etc and so on. I am binding this list to array and looping inside ng-repeat. So based on the number of documents it generates file upload controls as below.
<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" file-model="{{file}}" />
</div>
</div>
Note: we can upload obly one document on one upload. So clearly if i have 4 documents in files array then 4 file upload controls will generate.
Finally i have one button which should save all the above files on click.
<input type="submit" value="{{ 'NEXT' | translate }}" class="blue-button" ng-click="uploadFile(files)">
I have this function to save file(Taken from fiddler)
$scope.uploadFile = function(filename){
//Here i want to save all the files. For example if there are three documents in array files then 3 documents at a time i want to send it to server.
};
As you can see, fiddler will be having separate functions to save each file individually. I am trying to send all the files at a time.
May i get some help here? I am not sure what should be written inside $scope.uploadFile function? How can i collect here all files data? Thank you.