Commit 03c9e5d63623d58dbac8582eabfb58a96a21fd4b
1 parent
397ded5808
Exists in
master
upload file
Showing
1 changed file
with
22 additions
and
21 deletions
Show diff stats
script.js
... | ... | @@ -672,7 +672,7 @@ |
672 | 672 | var binaryString = readerEvt.target.result; |
673 | 673 | $scope.base64textString = btoa(binaryString); |
674 | 674 | //console.log("base64textarea",$scope.base64textString) |
675 | - $scope.data.uploadFile = file.name; | |
675 | + //$scope.data.uploadFile = file.name; | |
676 | 676 | $scope.fileSelect = false; |
677 | 677 | if($scope.data.uploadFile == null){ |
678 | 678 | $scope.fileSelect = true; |
... | ... | @@ -743,7 +743,8 @@ |
743 | 743 | } |
744 | 744 | |
745 | 745 | $scope.submit = function() { |
746 | - | |
746 | + $scope.data.uploadFile = $scope.base64textString; | |
747 | + console.log($scope.data.uploadFile) | |
747 | 748 | // if($scope.tokencheck == false){ |
748 | 749 | // $scope.data.referalToken = null; |
749 | 750 | // } |
... | ... | @@ -758,24 +759,24 @@ |
758 | 759 | // if($scope.data.referalToken == null){ |
759 | 760 | // $scope.data.referalToken = "N.A." |
760 | 761 | // } |
761 | - // var file =document.getElementById('filePicker').files[0]; | |
762 | - // console.log("file",filePicker) | |
763 | - // var image = BASE_URL+'/containers/applicants/download/' | |
764 | - // var imagePath = file.name; | |
765 | - // $scope.data.uploadFile = image + imagePath; | |
766 | - // console.log($scope.data.uploadFile) | |
767 | - // var fd = new FormData() | |
768 | - // fd.append('filePicker',$scope.data); | |
769 | - // var deferred = $q.defer(); | |
770 | - // $http({ | |
771 | - // method:'POST', | |
772 | - // url: BASE_URL+'/containers/applicants/upload', | |
773 | - // data:fd, | |
774 | - // transformRequest:angular.identity, | |
775 | - // headers:{'Content-Type':undefined} | |
776 | - // }) | |
777 | - // .success(function(result){ | |
778 | - // deferred.resolve(result); | |
762 | + var file =document.getElementById('filePicker').files[0]; | |
763 | + //console.log("file",filePicker) | |
764 | + var image = BASE_URL+'/containers/images/download/' | |
765 | + var imagePath = file.name; | |
766 | + $scope.data.uploadFile = image + imagePath; | |
767 | + //console.log($scope.data.uploadFile) | |
768 | + var fd = new FormData() | |
769 | + fd.append('filePicker',file); | |
770 | + var deferred = $q.defer(); | |
771 | + $http({ | |
772 | + method:'POST', | |
773 | + url: BASE_URL+'/containers/images/upload', | |
774 | + data:fd, | |
775 | + transformRequest:angular.identity, | |
776 | + headers:{'Content-Type':undefined} | |
777 | + }) | |
778 | + .success(function(result){ | |
779 | + deferred.resolve(result); | |
779 | 780 | $http({ |
780 | 781 | method: 'POST', |
781 | 782 | url: BASE_URL+'/applicants', |
... | ... | @@ -882,8 +883,8 @@ |
882 | 883 | // }) |
883 | 884 | |
884 | 885 | //} |
886 | + }) | |
885 | 887 | }) |
886 | - | |
887 | 888 | } |
888 | 889 | |
889 | 890 | }); | ... | ... |