Clear file queue on Jquery file Upload plugin Angularjs Version -


i use angularjs version of blueimp file upload plugin.(website)

if upload files first time works , second time plugin upload file , first 1 ...

i saw $scope.queue not reset after upload. there clear function don't know how use it.

there code :

candidats.controller('cvuploadcontroller', function($scope, $rootscope, $http, $modal, $window, $location, toaster, $timeout) {   var indexfile = 0;   $scope.options = {     url: '/api/cvapi/',     autoupload: false,     dropzone: $('fileupload'),     done: function(e, data) {       $scope.filename = data.result.result;       $scope.array = $scope.candidat.niveauetude.libelle.split('+');       $http.put("/api/cvapi?filename=" + $scope.filename + "&path=" + $scope.array[0] + "%2b" + $scope.array[1] + "&candidatid=" + $scope.candidat.id + "&nomcv=" + $scope.fichiers[indexfile].nom + "&cvid=0" + "&langueid=" + $scope.fichiers[indexfile].langueid)         .success(function() {           $scope.getcvs();         });       indexfile++;       if (indexfile == $scope.fichiers.length) {         indexfile = 0;       }     }   };   $scope.$on('fileuploadstop', function(e, data) {     $scope.getcvs();     $scope.fichiers = [];     $scope.queue = [];    });   $scope.$on('fileuploadchange', function(e, data) {     $.each(data.files, function(index, file) {       var fichier = {         nom: file.name.replace(/\.[^\.]*$/, ''),         langueid: 1       }       $scope.fichiers[index] = fichier;       if (index == data.files.length - 1) {         $('#cvmodal').modal();       }     });   }) }); 

here html:

<div class="row" ng-controller="cvuploadcontroller">   <form id="fileupload" method="post" enctype="multipart/form-data" file-upload="options" ng-class="{'fileupload-processing': processing() || loadingfiles}">     <div class="col-lg-7">       <!-- fileinput-button span used style file input field button -->       <span class="btn btn-success fileinput-button" ng-class="{disabled: disabled}">                                                             <i class="glyphicon glyphicon-plus"></i>                                                             <span>add files...</span>       <input type="file" name="files[]" multiple ng-disabled="disabled">       </span>       <!-- global file processing state -->       <span class="fileupload-process"></span>     </div>     <!-- global progress state -->     <div class="col-lg-5 fade" ng-class="{in: active()}">       <!-- global progress bar -->       <div class="progress progress-striped active" file-upload-progress="progress()">         <div class="progress-bar progress-bar-success" ng-style="{width: num + '%'}"></div>       </div>       <!-- extended global progress state -->       <div class="progress-extended"></div>     </div>     <div class="modal fade" id="cvmodal" tabindex="-1" role="dialog" aria-labelledby="mymodallabel" aria-hidden="true" style="padding-top:10px">       <div class="modal-content">         <div class="modal-header">           <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>           <h4 class="modal-title" id="mymodallabel">détails cv</h4>         </div>         <div class="modal-body">           <div ng-repeat="data in fichiers">             <label>nom cv</label>             <input class="form-control" ng-model="fichiers[$index].nom" />             <br />             <select class="form-control" ng-model="fichiers[$index].langueid" ng-options="langue.id langue.libelle langue in languescv"></select>             <br />           </div>           <button type="button" class="btn btn-danger" data-dismiss="modal" ng-click="cancel()">annuler</button>           <a class="btn btn-success" data-dismiss="modal" ng-click="submit()">valider</a>         </div>       </div>       <!-- /.modal-content -->     </div>     <!-- /.modal-dialog -->   </form> </div> 

thanks in advance !


Comments

Popular posts from this blog

Java 3D LWJGL collision -

spring - SubProtocolWebSocketHandler - No handlers -

methods - python can't use function in submodule -